SQL Formatter & Beautifier
Make long SQL queries readable: each clause on its own line, columns listed, joins and conditions indented.
- Free & unlimited
- No sign-up
- Instant results
How to use SQL Formatter
- Paste your SQL query or open a .sql file.
- Choose keyword case, indent and comma style, or minify.
- Copy the formatted SQL or download it.
Works with most databases
The formatter understands standard SQL plus common dialect features: MySQL backticks, SQL Server [brackets], PostgreSQL :: casts and $$ bodies, CTEs (WITH), window functions, CASE, UNION, INSERT, UPDATE, DELETE and CREATE TABLE. Strings and comments are never changed.
Readable SQL
- One clause per line: SELECT, FROM, WHERE, GROUP BY, ORDER BY.
- One column per line, so changes show up clearly in code reviews.
- AND / OR conditions on their own lines.
- Sub-queries indented inside their brackets.
Frequently asked questions
Does it check if my SQL is correct?
No. It formats the text; it doesn't run or validate the query against a database.
Will it change my query?
Only spacing, line breaks and (if you choose) keyword case. Values, names and strings are kept.
Can I format several statements?
Yes; separate them with semicolons.
Is my SQL uploaded?
No, everything happens in your browser.
Related tools
JSON Formatter & Validator
Format, validate and minify JSON with clear error messages.
Code Beautifier
Format HTML, CSS, JavaScript, JSON, YAML and Markdown.
XML Formatter
Beautify, validate and minify XML.
CSV to JSON Converter
Convert CSV or Excel data into a JSON array.
More Developer Tools
JSON to CSV Converter
Convert a JSON array to CSV for Excel or Google Sheets.
Base64 Encode & Decode
Encode text to Base64 or decode Base64, UTF-8 safe.
URL Encode & Decode
Percent-encode or decode URLs and split them into parts.
UUID Generator
Generate random v4 or time-ordered v7 UUIDs in bulk.
JWT Decoder
Decode a JSON Web Token and check when it expires.
Hash Generator
MD5, SHA-1, SHA-256 and SHA-512 hashes for text or files.
HTML Entity Encoder & Decoder
Escape < > & " for HTML, or decode & style entities.
Unix Timestamp Converter
Convert Unix epoch time to a date and back.