How to use it
- Paste code, drop a file or load the sample; the language is preset for this page and can be changed.
- Choose format or minify and adjust indent, width and other options; the result appears on the right as you type.
- Copy or download the result; on an error, use "Go to error", fix it and run again.
SQL dialects and keyword case
Databases differ: MySQL uses backticks, SQL Server square brackets, PostgreSQL :: casts. Pick the right dialect so these parse correctly; upper-case keywords are the most common convention, or keep them as written.
| Dialect | Typical syntax |
|---|---|
| MySQL / MariaDB | `table`, LIMIT 10 |
| PostgreSQL | value::int, RETURNING * |
| SQL Server (T-SQL) | [table], TOP 10 |
| Oracle PL/SQL | NVL(), ROWNUM |
| BigQuery | `project.dataset.table` |
| SQLite / Snowflake / Redshift / Spark / Hive / Trino / Db2 | Their own functions and keywords |
Languages and engines
Formatting uses the same open-source engines as popular editors, so results match Prettier in VS Code and your team can keep one style. Every engine loads from this site and runs in your browser.
| Language | Format | Compress |
|---|---|---|
| HTML | Prettier 3 | ✓ comments and whitespace |
| XML | XunL XML engine | ✓ |
| CSS / SCSS / Less | Prettier 3 | ✓ CSSO restructuring |
| JavaScript / TypeScript | Prettier 3(Babel) | ✓ Terser (JavaScript only) |
| JSON | Prettier 3 | ✓ big numbers keep precision |
| YAML | Prettier 3 | — (comments kept) |
| SQL | sql-formatter (14 dialects) | — |
Frequently asked questions
Why choose a dialect?
Databases quote identifiers and name functions differently, such as MySQL backticks, SQL Server brackets and PostgreSQL :: casts. The right dialect parses them correctly; the wrong one may error or split them oddly.
Can formatting change query results?
No, only whitespace, line breaks and keyword case change; strings and quoted identifiers are untouched. Still run it once on a test database before production.
Is my code uploaded?
No. The engines download from this site and run in your browser; your code never passes through our servers or any third party, so it is safe for internal code and configuration.
How large can files be?
Up to 5 MB per file; above 300 KB the page waits for the button instead of formatting as you type, to keep the browser responsive.