SQL Formatter
Format & beautify SQL live across 7 dialects — configurable keyword case and indentation, with statement stats.
About this ToolHow it works, benefits & use casesTap to collapse
Turn a long, run-on query into a clean, aligned statement that is easy to read and review. This SQL formatter uses the sql-formatter library and supports seven dialects: Standard SQL, MySQL, PostgreSQL, MariaDB, SQLite, T-SQL (SQL Server), and PL/SQL (Oracle). Pick the dialect that matches your database so clauses, joins, and functions are laid out correctly. You also control the keyword case — UPPERCASE, lowercase, or preserve as written — and choose the indentation by setting a tab width or switching to tabs. The formatted SQL regenerates live as you type or change options, and a stats line reports the number of statements, the line count, and the byte size of the result. Everything runs in your browser, so queries that touch sensitive schemas never leave your machine — no upload, no sign-up.
How to Use
- 1Pick your database in the Dialect select: Standard SQL, MySQL, PostgreSQL, MariaDB, SQLite, T-SQL, or PL/SQL.
- 2Choose the keyword case (UPPERCASE, lowercase, or Preserve) and set the tab width, or toggle Use tabs.
- 3Paste your SQL into the input box, or click Load example to load a multi-join query on one line.
- 4The formatted SQL regenerates live as you type or change options.
- 5Press Format SQL to confirm the result and surface any formatting error.
- 6Copy the formatted SQL, download it as formatted.sql, or share the URL with your query and options encoded in it.
Key Benefits
- Supports 7 dialects: Standard SQL, MySQL, PostgreSQL, MariaDB, SQLite, T-SQL, and PL/SQL
- Keyword case control — uppercase, lowercase, or preserve as typed
- Configurable indentation with a tab width or tabs
- Stats line reports statement count, line count, and byte size
- Live reformatting as you edit the query or change options
- Shareable URL captures your SQL and all options for handoff
- Runs entirely in-browser — your queries are never uploaded
Common Use Cases
- Making a dense, single-line query readable before reviewing or debugging it
- Standardising query formatting across a team or migration files
- Reformatting SQL copied from logs, ORMs, or a query builder
- Choosing the right dialect so SQL Server or Oracle syntax aligns correctly
- Preparing a query for documentation or a pull request with consistent casing
Options
0 characters · live
Paste SQL above to format it live.
Was this tool helpful?
Share Your Experience
Help others discover this tool!
Related tools
- SQL Query FormatterFormat and beautify SQL with configurable keyword case, indentation, and comma style, plus a minifier and a referenced-tables/columns stats panel
- Database Schema VisualizerPaste SQL DDL and get a live ER diagram with typed columns, PK/FK/unique markers, and relationships; export to Mermaid, PlantUML, DBML, ASCII, or JSON
- SQL to NoSQL ConverterConvert SQL SELECT/INSERT/UPDATE/DELETE to MongoDB find queries or aggregation pipelines, with output for the Mongo shell, Node.js driver, or Mongoose and a clause-by-clause mapping
- CSV to SQL ConverterTurn CSV into CREATE TABLE + INSERT statements with delimiter auto-detect, per-column type inference, and dialect-aware output for PostgreSQL, MySQL, SQLite, or SQL Server
- SQL Mock Data GeneratorGenerate seeded, reproducible mock data from a schema you define, with 25+ field types and dialect-aware output for PostgreSQL/MySQL/SQLite/SQL Server as SQL, CSV, JSON, NDJSON, or TypeScript
- Code Block FormatterFormat code blocks for Markdown
Seven: Standard SQL, MySQL, PostgreSQL, MariaDB, SQLite, T-SQL (SQL Server), and PL/SQL (Oracle). Selecting the right dialect helps the formatter recognise dialect-specific keywords and syntax so the output is laid out correctly for your database.
Yes. The Keyword case option offers UPPERCASE (a common convention for SELECT, FROM, WHERE), lowercase, or Preserve, which keeps the casing exactly as you wrote it. Pick the style that matches your team’s SQL conventions.

