Beautify SQL in 20 dialects
- Free
- No sign-up
- No upload
- Works offline
Tool facts
- Opens
SQLTXT- Saves as
SQL- Price
- Free, no sign-up, no watermark
- Are files uploaded?
- No. Everything is processed in this browser, on your device.
- Batch processing
- One file at a time
- Offline use
- Works without a connection once this page has loaded
- Built with
- sql-formatter
- Browser
- A recent Chrome, Edge, Firefox or Safari, on computer or phone.
Check it yourself: press F12, open the Network tab, then use the tool. No request carries your data.
About SQL Formatter
This SQL formatter rewrites long, single-line or inconsistently written SQL into a clean layout with one clause per line, indented joins, subqueries and conditions, and keywords in the case you choose. It formats SELECT, INSERT, UPDATE, DELETE, CREATE and other statements, keeps comments and string literals intact, and separates multiple queries with blank lines. The result updates as you type or paste.
Because SQL dialects differ in keywords, quoting and operators, pick the one you use: Standard SQL, MySQL, MariaDB, PostgreSQL, SQLite, SQL Server (T-SQL), Oracle PL/SQL, BigQuery, Snowflake, Redshift, Spark, Hive, Trino, DuckDB, ClickHouse, Db2, N1QL, SingleStoreDB or TiDB. Formatting is done by the open-source sql-formatter library running in your browser, so queries that contain table names, customer data or credentials are never uploaded. It formats only; it does not execute or validate queries against a database.
SQL Formatter runs entirely in your browser. Your data is processed on your device and is never uploaded to Qiyi or anyone else.
How to use SQL Formatter
- Paste your SQL into the Input box, or open or drop a .sql file.
- Choose your Dialect, then pick a Keyword case (UPPER, lower or Preserve) and an Indentation.
- Optionally change Indent style, where AND/OR line breaks go, the blank lines between queries, or turn on Dense operators.
- Copy the formatted SQL from the Output box or click Download to save it as a .sql file.
Frequently asked questions
Why should I choose the right SQL dialect?
Each database has its own keywords, identifier quotes and operators, such as backticks in MySQL, square brackets in SQL Server, :: casts in PostgreSQL or @variables in T-SQL. With the wrong dialect these may be split or indented incorrectly, or cause a parse error. Standard SQL works for simple ANSI queries.
Why do I get a parse error?
The formatter needs to tokenize the query, so an unclosed quote or bracket, a dialect-specific feature in the wrong dialect, or template placeholders such as {{table}} can stop it. The status message shows where it stopped. Switching the dialect often fixes it.
Does the formatter change what my query does?
No. It only changes whitespace, line breaks and, if you choose UPPER or lower, the case of keywords, data types and function names. Identifiers, string literals and comments are left as written, so the query returns the same result.
Should SQL keywords be uppercase?
SQL is case-insensitive for keywords, so it is a style choice. Uppercase keywords (SELECT, FROM, WHERE) are the most common convention because they stand out from table and column names. Many teams prefer lowercase for less visual noise; pick one and use it consistently.
Is my SQL sent to a server?
No. The formatter runs entirely in your browser. Nothing is uploaded, and no connection to any database is made.