FORMAT / DEVDESK
SQL Formatter
Break SQL clauses onto readable lines. The formatter does not execute queries or connect to a database.
This tool formats SQL only; it does not execute queries or guarantee validity. Queries are processed in your browser.
Input and output examples
Example 1
Input
SELECT id,name FROM users WHERE active=1 ORDER BY name;Output
SELECT
id,
name
FROM users
WHERE active = 1
ORDER BY name;Example 2
Input
WITH recent AS (SELECT id FROM events WHERE created_at > CURRENT_DATE) SELECT id FROM recent;Output
WITH recent AS (
SELECT id
FROM events
WHERE created_at > CURRENT_DATE
)
SELECT id
FROM recent;How to use it
- Paste SQL or load an example.
- Choose Generic, MySQL, PostgreSQL, or Oracle formatting.
- Set indentation, format the text, and review it before copying.
Frequently asked questions
Does this validate SQL?
No. It formats text only; it neither runs SQL nor verifies database-specific syntax.
Can I format MariaDB and Oracle SQL?
Choose the MySQL dialect for MySQL-family syntax and PL/SQL for Oracle. Coverage follows the formatter library.
Are comments and string literals preserved?
The formatter tokenizes comments and literals. Review important query sections before using the formatted result.