Format and beautify SQL queries with clause line breaks and consistent keyword casing, or minify them to a single line.
How to use the SQL Formatter
Paste your SQL query into the input box.
Choose Format to beautify it or Minify to compress it to one line.
Pick the keyword casing, then copy the result.
Frequently asked questions
It puts each major clause such as SELECT, FROM, WHERE and JOIN on its own line, indents the columns and conditions, and normalises keyword casing for readability.
No. Formatting runs entirely in your browser, so your queries never leave your device. That makes it safe for queries that mention table or column names.
It is dialect-agnostic and handles common ANSI SQL used by PostgreSQL, MySQL, SQLite and SQL Server. It formats for readability rather than validating syntax.
A SQL formatter that beautifies queries with clause line breaks, indentation and consistent keyword casing, or minifies them to a single line.
Everything runs in your browser, so it is fast and your queries stay private.
Related tools
Generate SHA-1, SHA-256, SHA-384 and SHA-512 hashes of any text, right in your browser.
Convert colors between HEX, RGB and HSL with a live preview.
Convert Unix timestamps to human dates and back — UTC, local, ISO 8601 and relative time. Seconds and milliseconds are auto-detected.
Percent-encode and decode URLs and URL components, UTF-8 safe.
We use essential cookies to run the site. With your consent we also load Google AdSense, which sets advertising cookies. See our privacy policy.