consolelog.tools

SQL Formatter

Format & beautify SQL live across 7 dialects — configurable keyword case and indentation, with statement stats.

About this ToolHow it works, benefits & use cases

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

  1. 1Pick your database in the Dialect select: Standard SQL, MySQL, PostgreSQL, MariaDB, SQLite, T-SQL, or PL/SQL.
  2. 2Choose the keyword case (UPPERCASE, lowercase, or Preserve) and set the tab width, or toggle Use tabs.
  3. 3Paste your SQL into the input box, or click Load example to load a multi-join query on one line.
  4. 4The formatted SQL regenerates live as you type or change options.
  5. 5Press Format SQL to confirm the result and surface any formatting error.
  6. 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