SQL formatter
Format SQL with clean indentation for PostgreSQL, MySQL, SQLite and SQL Server, or minify it to one line.
Missing a feature or found a bug in SQL formatter? Tell me on X (@_andrewtran) or by email.
How to use SQL formatter
- Paste your SQL in the input pane.
- Choose the indentation and dialect, or choose Minify.
- Copy the result or download it as a .sql file.
Questions and answers
Is my data sent anywhere?
No. Everything runs in your browser on this device. Nothing you paste is uploaded or stored.
Is my query run?
No. The text is only rearranged. Nothing connects to a database.
Does the dialect matter?
For most queries, no. It matters for features one database has and others lack, such as backtick names in MySQL or square brackets in SQL Server.
Related tools
HTML formatter
Beautify HTML with consistent indentation, or minify it by removing comments and spare whitespace.CSS formatter
Beautify CSS rules and media queries, or minify CSS with strings and comments handled safely.JSON viewer
Explore JSON as a collapsible tree, with counts for every object and list.Mock data generator
Generate made-up users, orders and products as JSON, CSV or SQL, from a schema you can edit.