SQL Formatter & Minifier
Format SQL queries for MySQL, PostgreSQL, SQL Server, SQLite and more, with keyword case and indentation options, or minify them to one line without comments.
Free, no sign-up
Saved on your device only
Works offline after first open
The tool
Loading the tool…
How to use
- Paste a query or open a .sql file.
- Choose the dialect and keyword case.
- Choose Format to tidy it or Minify for one line, then copy the result.
Privacy & how it works
Saves your data in this browser only (back it up or delete it from “My data”).
- Engine: sqlFormatter (open-source libraries bundled with the site).
- Works offline after you open it once.
Frequently asked questions
Why do some queries show an error?
The formatter reads the query using the selected dialect. If it uses syntax from another database (such as SQL Server [brackets] or PostgreSQL $$), pick the right dialect.
Does minifying remove important comments?
It removes ordinary -- and /* */ comments but keeps /*! (MySQL directives) and /*+ (Oracle hints). # counts as a comment only for MySQL and MariaDB.
Does it run the query?
No. It only rearranges the text and never connects to a database.
Related tools
JavaScript Formatter & CompactorBeautify JavaScript or JSON with your choice of indentation and brace style, or compact it by removing comments and whitespace while keeping the line breaks the code relies on. Names are never changed.XML Formatter & ValidatorPretty-print or minify XML (and SVG or RSS), and check it is well-formed: matching tags, a single root, quoted attributes and valid & entities, with the line and column of any error.Code to ImageTurn code into a clean image for slides, reports and social posts: automatic highlighting for 30+ languages, light and dark themes, a window frame and line numbers, exported as high-resolution PNG or SVG.CSV to JSONConvert CSV or TSV to JSON: an array of objects, arrays or columns, with real numbers and booleans, and nested objects from headers like address.city. Arabic supported.