SQL Formatter & Beautifier
Turn one-line or messy SQL into readable, consistently indented queries.
- Runs in your browser — nothing uploaded
- Instant, no waiting in a queue
- Free, no watermark, no daily limits
Paste a SQL query and format it with clear line breaks and indentation for clauses, joins and subqueries, using the open-source sql-formatter library. Choose a dialect — Standard SQL, MySQL, MariaDB, PostgreSQL, SQLite, SQL Server (T-SQL), Oracle PL/SQL, BigQuery, Snowflake, Redshift, Spark or Trino — so dialect-specific syntax is understood. Set keywords to UPPER, lower or unchanged, pick an indent, or compact a query onto one line while string literals stay untouched.
How to Format a SQL Query
- 1
Pick the dialect
Choose your database, such as MySQL or PostgreSQL.
- 2
Paste the query
Paste SQL or open a .sql file, and choose keyword case and indent.
- 3
Format and copy
Click Format (or One line), then copy or save the result.
Why use ToolzBank SQL Formatter?
- 12 SQL dialects including MySQL, PostgreSQL and T-SQL
- UPPER, lower or preserved keyword case
- 2 spaces, 4 spaces or tab indentation
- Formats multiple statements at once
- One-line compact mode that keeps strings intact
- Open and save .sql files
Frequently asked questions
Does formatting change what my query does?
Which databases are supported?
Why does it say the query could not be parsed?
Does it validate my SQL?
Is my SQL sent to a server?
More free developer tools
JSON Formatter & Validator
Beautify, minify & validate JSON
JSON to CSV
Flatten JSON arrays into CSV/Excel
XML Formatter
Pretty-print & validate XML
JWT Decoder
Decode & verify JSON Web Tokens locally
Regex Tester
Test regular expressions live
Timestamp Converter
Unix epoch ⇄ human-readable dates
Diff Checker
Compare two texts line by line
Base64 Encoder / Decoder
Encode & decode Base64 text and files
URL Encoder / Decoder
Percent-encode, decode & parse URLs
HTML, CSS & JS Formatter
Beautify HTML, CSS & JS; minify HTML & CSS
Hash Generator
MD5, SHA-1, SHA-256 & SHA-512 for text or files
Number Base Converter
Binary, octal, decimal & hex conversion
PX to REM Converter
Convert px ⇄ rem, or a whole stylesheet
Color Converter
HEX, RGB, HSL, HSV & CMYK with contrast check
YAML to JSON Converter
Convert YAML ⇄ JSON with error lines
Markdown Editor
Write visually, download a .md file
From Our Blog
How to Format SQL Queries (MySQL, PostgreSQL and More)
Readable SQL is easier to debug and review. Learn simple formatting conventions and beautify any query for MySQL, PostgreSQL, SQL Server and more.
How to Format and Validate XML Online (Pretty Print or Minify)
Make one-line XML readable, find the exact line of a syntax error, or minify XML — for sitemaps, RSS feeds, SVG and config files.
How to Format, Validate and Minify JSON Online
How to turn unreadable minified JSON into properly indented, readable structure, catch syntax errors instantly, and minify it back down for production use.
