SimplyToolbox
⌘K
ImageVideoPDFDeveloperCalculatorBlogAbout
HomeDeveloper ToolsSQL Formatter
🗄️

SQL Formatter

Format and minify SQL queries with keyword highlighting and dialect support.

Dialect

What the SQL Formatter does

This tool takes a cramped, single-line, or inconsistently cased SQL query and reformats it into a clean, readable layout. It uppercases recognised SQL keywords, places major clauses such as SELECT, FROM, WHERE, JOIN, GROUP BY, and ORDER BY on their own lines, and indents conditional keywords like AND, OR, WHEN, THEN, and ELSE so the structure of the statement is easy to scan.

It is aimed at developers, analysts, and database administrators who paste queries from logs, ORMs, or quick experiments and want them tidied up for review, documentation, or sharing. A Minify button does the reverse, collapsing all whitespace into a compact single line for embedding a query in code or a config file.

How to use it

Pick a dialect (MySQL, PostgreSQL, SQLite, or MSSQL) using the buttons at the top, then paste or type your query into the SQL Input box. Click Format SQL to produce the indented, keyword-cased version, or Minify to compress everything to one line. The result appears in the read-only output area below.

Use Copy Output to put the formatted query on your clipboard, or Clear to reset both boxes. The dialect setting mainly affects keyword handling, for example converting ILIKE to LIKE when SQLite is selected, since SQLite does not support ILIKE.

Notes and limitations

The formatter works by recognising a built-in list of common SQL keywords and functions, then normalising spacing and line breaks around them. It is a lightweight, pattern-based formatter rather than a full SQL parser, so very complex statements with deeply nested subqueries or vendor-specific syntax may not be laid out perfectly, but the output remains valid and equivalent to your input.

Because it only reorganises whitespace and capitalisation, it never changes the meaning of your query, the table or column names, or string literals inside quotes.

Frequently Asked Questions

Does the SQL Formatter send my query anywhere?▼
No. All formatting and minifying happen entirely in your browser with JavaScript. Your SQL is never uploaded, logged, or sent to a server.
Which SQL dialects are supported?▼
You can choose MySQL, PostgreSQL, SQLite, or MSSQL. The dialect mainly affects keyword handling, such as converting ILIKE to LIKE for SQLite which does not support it.
Does formatting change what my query does?▼
No. The tool only adjusts whitespace, line breaks, and keyword capitalisation. Table names, column names, and quoted string literals are left exactly as you wrote them.
Can it handle very complex queries?▼
It handles most everyday queries well. Because it is a lightweight pattern-based formatter rather than a full SQL parser, extremely nested subqueries or unusual vendor syntax may not be indented perfectly, though the output stays equivalent to the input.
What does the Minify button do?▼
Minify collapses all the whitespace in your query into a single line, which is useful for embedding a query in source code or a configuration value.
Is the tool free?▼
Yes, it is completely free to use with no account, no installation, and no usage limits.

You might also like

{ }

JSON Formatter

Format, validate and beautify JSON

📊

JSON to CSV

Convert JSON data to CSV format

🔄

CSV to JSON

Convert CSV to JSON format

🔐

Base64 Encoder/Decoder

Encode or decode Base64 strings

SimplyToolbox

90+ free online tools. No signup. No limits. Just tools that work.

AboutContactBlogPrivacy PolicyTerms of Use

Image & Video

  • Image Compressor
  • Image Resizer
  • Image Converter
  • Video Compressor
  • Video to GIF
  • Screen Recorder

PDF & Text

  • PDF Compressor
  • PDF Merger
  • PDF Splitter
  • Word Counter
  • Markdown Editor
  • Text Diff Checker

Developer

  • JSON Formatter
  • Base64 Encoder
  • Hash Generator
  • Password Generator
  • UUID Generator
  • Regex Tester

Tools & More

  • Unit Converter
  • BMI Calculator
  • Currency Converter
  • QR Code Generator
  • Color Picker
  • Gradient Generator

© 2026 SimplyToolbox. All rights reserved.

Processing happens in your browser — your files stay private.