Code Formatting Tools
SQL Formatter
Lay out SQL queries so clauses and expressions are easier to follow. Choose a dialect and indentation style, then review uppercase keywords and clear line breaks locally.
✓ Every tool runs in your browser. We do not upload your input or output.
Keyboard shortcuts
Ctrl/⌘ + Enter: process
Ctrl/⌘ + Shift + F: full screen
Esc: exit full screen
Ctrl/⌘ + F in editor: search
How to use
- Paste a query, upload a .sql file, or load the sample SELECT statement.
- Choose Standard SQL, PostgreSQL, MySQL, or SQLite, then set indentation.
- Review the formatted query and correct any dialect-specific parsing error.
- Copy or download the result after checking it against your database's syntax.
Examples
Read a filtered query
Clauses appear on separate lines so filters and ordering are easier to inspect.
select id, name from users where active = true order by name;
SELECT id, name FROM users WHERE active = TRUE ORDER BY name;
Select the right dialect
PostgreSQL mode recognizes double-quoted identifiers used in that dialect.
select "first-name" from users;
SELECT "first-name" FROM users;
Make a query easier to reason about
SQL often arrives as a single line in a log, test fixture, or generated report. Breaking clauses apart can reveal a missing condition or a join that is easy to overlook. This formatter lays out common statements and capitalizes recognized keywords. It supports Standard SQL plus selected PostgreSQL, MySQL, and SQLite syntax. Choose the dialect before processing so quoted identifiers and operators are interpreted correctly.
Indentation can use two spaces, four spaces, or tabs. The output is intended for human review, documentation, and source files. The formatter does not connect to a database, run a query, or substitute parameter values. Your query stays in the browser; processing happens in a Web Worker.
Formatting is one step in verification
A parser may report an unexpected token when the selected dialect does not match the query. Try the database’s dialect before assuming the query is invalid. Even if formatting succeeds, only the target database can confirm whether referenced tables exist and whether the query is permitted. Check execution plans and parameter handling separately for production use.
SQL comments, string literals, and placeholders can affect a query’s meaning. Read the generated statement before replacing code, especially for vendor-specific features or templated SQL. For long inputs, use the shared workspace’s internal scrolling and Process button. Copy and Download return the full output, while the preview can be shortened for very large results.
Frequently asked questions
Does the formatter execute my query?
No. It only reads and rewrites text in a browser worker. There is no database connection.
Why should I choose a dialect?
Quoting, operators, and keywords differ between databases. The matching dialect helps the parser read your query.
Is a formatted query guaranteed to run?
No. Formatting does not validate tables, column names, permissions, or database-specific semantics.
Are parameters replaced?
No. The tool does not supply values for placeholders; review the output before using it in application code.
Can it format stored procedures?
Complex procedural SQL is outside this tool's intended scope. Format ordinary queries and verify specialized syntax in your database tools.