Skip to content

SQL Formatter

Runs in your browser

Paste a query to indent it clause by clause, or pack it onto one line. Ten SQL dialects are supported.

Options

Input

Output

Formatting…

How this one works

Paste a query on the left and the formatted version appears on the right as you type. Each clause (SELECT, FROM, JOIN, WHERE, GROUP BY) starts on its own line, with its columns and conditions indented beneath it. Pick your database from the dialect menu so its own syntax, quoting and keywords are recognised.

Minify does the opposite: one line, comments removed, and string literals kept exactly as written, which is handy for pasting a query into code, a log search or a config file.

Questions

Is it safe to paste production queries here?

Yes. Formatting happens in your browser with JavaScript bundled into the page. The query is never sent to a server, logged or stored. Close the tab and it's gone.

Which SQL dialects are supported?

Standard SQL, MySQL, MariaDB, PostgreSQL, SQLite, SQL Server (T-SQL), Oracle (PL/SQL), BigQuery, Redshift and Snowflake. Choosing the right one matters for things like backtick or bracket identifiers, dollar-quoted strings and dialect-specific keywords.

Why does my query fail to format?

The formatter reads the query before laying it out, so it stops at anything it can't parse: an unclosed bracket, a missing clause or syntax from another database. The error gives the line and column. If the query runs on your database, choose that dialect: backtick identifiers, square brackets and @variables are only valid in some.

Does formatting change what my query does?

No. Only whitespace, line breaks and (if you choose) the case of keywords change. Table names, column names and string values are left exactly as you wrote them.

Keyboard shortcuts

Global

  • Show this shortcuts dialogShift?
  • Toggle light / dark themeCtrlShiftL
  • Close dialogsEsc

Formatter & Validator

  • Format JSONCtrlEnter
  • Minify JSONCtrlShiftM
  • Copy outputCtrlShiftC
  • Download output as .jsonCtrlShiftS
  • Clear input and outputCtrlShiftX

Tree Viewer

  • Focus the search box/
  • Expand all nodesCtrlShiftE
  • Collapse all nodesCtrlShiftR

Diff

  • Swap document A and BCtrlShiftS

Time & date tools

  • Use the current time (Epoch Converter)CtrlEnter
  • Copy the main resultCtrlShiftC
  • Clear the inputCtrlShiftX

PHP Unserialize & Serialize

  • Convert an input over 2 MBCtrlEnter
  • Copy outputCtrlShiftC
  • Download outputCtrlShiftS
  • Clear input and outputCtrlShiftX

Keys & IDs

  • Generate a new token or UUID batchCtrlEnter
  • Copy the resultCtrlShiftC

JSON tools

JSON FormatterPretty-print or minify
JSON ValidatorCheck strict JSON validity
JSON Tree ViewerBrowse JSON as a tree
JSON DiffCompare two documents
JSON Path FinderExplore JSONPath expressions
JSON to CSVFlatten JSON into rows
CSV to JSONTurn rows back into objects
PHP UnserializeSerialized PHP to JSON
PHP SerializeJSON to serialized PHP

JWT tools

JWT DecoderClaims, signature and expiry
JWT VerifierWith a secret, PEM key or JWKS
JWT Expiry Checkeriat, nbf and exp in local time
JWT GeneratorBuild a signed test token
Base64URL EncoderEncode or decode a segment

Time & date tools

Epoch ConverterTimestamps to real dates
Cron Expression ExplainerCron in plain English
Time Zone ConverterOne moment, many cities
Duration CalculatorDate maths and durations

Keys & IDs

Password GeneratorSecure random secrets
UUID Generatorv1, v4, v5 or v7 UUIDs

Code formatters

SQL FormatterBeautify or minify SQL
HTML FormatterBeautify or minify HTML
CSS FormatterBeautify or minify CSS
JavaScript FormatterBeautify or minify JS
PHP FormatterBeautify PHP code
Markdown to HTMLConvert with a live preview

AI tools

Token CounterTokens for every model
Prompt Secret ScrubberHide keys and personal data

Pages

JSON toolsFormat, validate, compare and convert JSON.
JWT toolsDecode, verify and generate JSON Web Tokens.
Time & date toolsConvert timestamps, read cron, compare zones.
Keys & IDsGenerate secure tokens, passwords and UUIDs.
Code formattersFormat SQL, HTML, CSS, JavaScript and PHP code.
AI toolsCount tokens and hide secrets before you prompt.
HomePopular tools and categories
All categoriesBrowse tools by category
AboutWhat ToolJar is and why
PrivacyWhat is and is not collected

Theme

Switch to light theme
Switch to dark theme