SQL Formatter
Paste a SQL query to format it with consistent indentation, uppercase keywords and clause-by-clause line breaks. Pick your dialect (MySQL, PostgreSQL, SQLite, SQL Server) or use minify mode to compact a query into one line.
Your SQL is processed in your browser and is not uploaded to a server.
How to use this sql formatter
- Paste your SQL query into the input box.
- Pick the dialect (Standard / MySQL / PostgreSQL / SQLite / SQL Server).
- Choose your indent (2 spaces, 4 spaces or tab) and keyword case (uppercase, lowercase or preserve).
- Or switch to Minify to compact the query to a single line.
- Copy the result or download it as a .sql file.
Frequently asked questions
Which SQL dialects are supported?
Standard SQL plus MySQL, PostgreSQL, SQLite and SQL Server. The dialect setting widens the keyword list (e.g. PostgreSQL adds RETURNING, SQL Server adds TOP) so dialect-specific keywords are recognised and cased correctly.
Does it format multiple statements?
Yes. Statements separated by semicolons are formatted independently with a blank line between them.
Are comments preserved?
Yes for the formatter. Both line comments (-- ...) and block comments (/* ... */) are preserved on their own lines. The minifier strips comments to keep output as small as possible.
Is my query sent anywhere?
No. The formatter runs entirely in your browser using a custom tokenizer. Your queries never leave your device.