Skip to content

SQL formatter — pretty print queries offline

Paste a one-line query, get a readable one — pretty printed on your device, never on a server.

100% private — files never leave your device
SQL
Formatted

Pretty print SQL without uploading your queries

A SQL query is a description of your database. Table names, column names, join structure, business rules encoded as WHERE clauses — a single query can reveal more about how a company works than a page of documentation, and production queries frequently carry literal customer identifiers and email addresses in their predicates.

Formatting here runs with the open-source sql-formatter library in your browser, live as you type. Nothing is transmitted; the site has no backend, and a Content-Security-Policy blocks third-party requests. Load the page, disconnect, and it still formats.

Dialects and keyword casing

Pick the dialect that matches your database — standard SQL, plus PostgreSQL, MySQL, SQLite, and BigQuery. It matters more than it sounds: dialects differ in quoting rules, in how they treat certain operators, and in which words are reserved, so formatting with the wrong one can produce output that reads oddly or breaks an identifier.

Keyword casing is a separate choice. UPPERCASE keywords against lowercase identifiers is the long-standing convention, and it earns its keep on long queries by making the structure scannable — you can find every JOIN and WHERE at a glance. Lowercase is increasingly common in modern codebases. Either way, identifiers are left exactly as you wrote them, since in case-sensitive databases changing them would change their meaning.

Why formatted SQL is worth the paste

Unformatted SQL arrives constantly — dumped from an ORM's debug log, extracted from an application trace, or pasted from a colleague as one enormous line. Reading a 400-character single-line query is genuinely difficult, and subtle mistakes hide in it: a join condition that silently became a cross join, a misplaced OR that widens a WHERE clause far beyond what was intended, a subquery correlated by accident.

Formatting is also what makes queries comparable. Two versions of the same query formatted consistently can be dropped into the diff checker, where the real change stands out instead of being buried in whitespace differences. Related and equally local: code formatter for HTML, CSS and JavaScript, and JSON formatter for query results.

How to pretty print SQL offline

  1. 1

    Pick your SQL dialect and keyword casing.

  2. 2

    Paste the query — formatting is live.

  3. 3

    Copy the formatted result.

SQL Formatter — frequently asked questions

Are my queries uploaded to be formatted?

No — formatting runs with the open-source sql-formatter library in your browser. Queries often reveal schema and business logic; here they never leave your device.

Which SQL dialects are supported?

Standard SQL plus PostgreSQL, MySQL, SQLite, and BigQuery dialect quirks — pick the dialect above the editor.

Can it change keyword casing?

Yes — choose UPPERCASE or lowercase keywords; identifiers are left untouched.

SQL Formatter guides