Handytool
DeveloperFreeRuns locally

SQL formatter

Pretty-print SQL queries — PostgreSQL, MySQL, SQLite, BigQuery and standard SQL — privately in your browser.

.sql
Dialect
Keywords
Indent
SQL input
0 lines0 bytes
Formatted SQL
0 lines0 bytes

About the SQL formatter

Handytool's SQL formatter pretty-prints any SQL query — SELECT, INSERT, complex CTEs, window functions — using the popular sql-formatter library. Pick the dialect (PostgreSQL, MySQL, SQLite, BigQuery, or standard SQL), choose how keywords should be cased, and set the indentation. Everything runs locally, so it's safe to format queries that contain table names, column names, or sample data you'd rather not paste into a third-party site.

SQL formatter features

  • 01

    Dialect-aware

    Each supported dialect has its own keyword list and reserved-word handling, so PostgreSQL's RETURNING, MySQL's backticks, and BigQuery's STRUCT syntax are all recognised correctly.

  • 02

    Keyword case control

    Force ALL CAPS, all lowercase, or preserve what the input uses. The most common house style is upper-case keywords, which is the default.

  • 03

    Configurable indent

    Choose 2 spaces, 4 spaces, or tabs. The output is consistent across CTEs, subqueries, and JOIN clauses.

SQL formatter FAQ

Which SQL dialects are supported?
Standard SQL (sql), PostgreSQL, MySQL, SQLite, and BigQuery. The underlying engine supports more dialects internally — these are the most useful for day-to-day work.
Will it run my query?
No. The formatter only re-renders the SQL text — it does not connect to any database, parse data, or execute statements.
Why does my non-standard syntax format oddly?
Vendor-specific extensions outside the chosen dialect (procedural blocks, stored-procedure syntax, MS SQL hints) may not lay out cleanly. Switch to the closest dialect, or paste shorter snippets at a time.
Is my SQL uploaded anywhere?
No. The sql-formatter library runs entirely in your browser — your queries stay on your device.

Related tools

Developer

Explore other tools

All tools