Advertisement

Format, beautify and minify any SQL query in your browser — keyword case, indent size, no upload. Free and private.

Everything runs in your browser — your SQL never leaves your device.

Keyword case
Indent
query.sql
1
Waiting for SQL…
formatted.sql

							
SQL Formatted SQL appears here

About SQL Formatter & Beautifier

This SQL formatter and beautifier turns dense, single-line queries into readable, consistently indented SQL — and can minify formatted SQL back to one line for logs or embedding. Choose the keyword case (UPPERCASE, lowercase, or keep as written) and the indent style: two spaces, four spaces or tabs.

It handles the everyday dialect-agnostic constructs — SELECT lists, JOINs, WHERE clauses, subqueries, GROUP BY and ORDER BY — making review, debugging and code-review diffs far easier than reading machine-generated or ORM-emitted SQL in raw form.

The formatter runs entirely in your browser; your SQL never leaves your device, so queries containing table names, schema details or embedded values stay private. Paste a query or try the sample, then copy the result or download it as formatted.sql.

How to use SQL Formatter & Beautifier

  1. Paste or type your SQL into the input pane, or click Sample to try an example query.
  2. Choose Beautify to pretty-print or Minify to collapse to one line.
  3. Set the keyword case — UPPER, lower or Keep — and the indent (2 spaces, 4 spaces or tab).
  4. Review the formatted output and its line count.
  5. Copy the result or download it as formatted.sql.

Frequently asked questions

Yes for formatting purposes — indentation and keyword casing are dialect-agnostic, so queries from any major database format cleanly. The tool formats text; it does not execute or validate against a specific engine.

Yes. The Minify mode strips line breaks and redundant whitespace to produce a compact single-line query, useful for log statements and embedding in code.

No. Formatting happens entirely in your browser, so SQL containing sensitive schema names or data values never touches a server.

Yes — force keywords to UPPERCASE, lowercase, or keep them exactly as you wrote them, matching whatever style your team's conventions require.

Yes, free with no query-length or usage limits.


Popular searches
sql formatter sql beautifier format sql online sql minify prettify sql query sql pretty print
Need help?
Found an issue with this tool? Let our team know.
Report an issue

Add this free tool to your own website — copy and paste the code below.