HTML Formatter
Auto-indent and organize HTML markup for better readability.
Format SQL queries to improve readability and team consistency.
Formats SQL with the sql-formatter library, supporting several dialects. Everything runs locally in your browser.
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**.
Comments are kept on purpose: in SQL a comment can be an optimiser hint (`/*+ INDEX(...) */`), and removing it can silently change the execution plan.
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).
Paste the SQL
The sample is a single SELECT; subqueries and joins are re-indented by the library.
Choose indentation or a mode
Format re-lays it out with 2 or 4 spaces; Minify collapses whitespace onto one line.
Copy the result
Both directions run locally, nothing is uploaded.
This page uses the library default, which is standard SQL. `sql-formatter` does support several dialects, but no switch is exposed here, so dialect-specific syntax (`LIMIT 1,2`, `::` casts, `\G`) may not lay out as you expect — reach for a dialect-aware wrapper or the library CLI in that case.
Deliberate. A SQL comment can be an optimiser hint (MySQL `/*+ ... */` for example), and dropping it can quietly change the query plan. This minifier only collapses whitespace and does not try to judge intent.
Auto-indent and organize HTML markup for better readability.
Minify HTML by removing extra spaces and non-essential characters.
Minify or prettify CSS code for production and maintenance workflows.
Beautify JavaScript code with consistent indentation and spacing.
Minify JavaScript to reduce file size for faster page delivery.
Format, validate, and beautify JSON for easier reading and debugging.
Compress JSON by removing unnecessary whitespace and line breaks.
Sort JSON object keys alphabetically to keep structure consistent.