SQL Formatter

Format SQL queries to improve readability and team consistency.

Tool Panel

Processed locally
Loading tool...
About SQL Formatter

Formats SQL with the sql-formatter library, supporting several dialects. Everything runs locally in your browser.

  • 1

    Formatting is delegated to the `sql-formatter` library (loaded on demand when the page opens), with 2- or 4-space indentation. Minifying is a small local implementation that **only collapses whitespace — comments and string literals stay untouched**.

  • 2

    Comments are kept on purpose: in SQL a comment can be an optimiser hint (`/*+ INDEX(...) */`), and removing it can silently change the execution plan.

  • 3

    Whitespace inside a literal like `'a b'` is preserved too — that is data, not layout (fixed 2026-09-20; it used to collapse the three spaces into one).

Related tools

View all
Format & Minify

HTML Formatter

Auto-indent and organize HTML markup for better readability.

Format & Minify
Format & Minify

HTML Minifier

Minify HTML by removing extra spaces and non-essential characters.

Format & Minify
Format & Minify

CSS Minifier

Minify or prettify CSS code for production and maintenance workflows.

Format & Minify
Format & Minify

JavaScript Formatter

Beautify JavaScript code with consistent indentation and spacing.

Format & Minify
Format & Minify

JavaScript Minifier

Minify JavaScript to reduce file size for faster page delivery.

Format & Minify
Format & Minify

JSON Formatter

Format, validate, and beautify JSON for easier reading and debugging.

Format & Minify
Format & Minify

JSON Minifier

Compress JSON by removing unnecessary whitespace and line breaks.

Format & Minify
Format & Minify

JSON Key Sorter

Sort JSON object keys alphabetically to keep structure consistent.

Format & Minify