SQL, XML & HTML Formatter
Data, Regex & TextFormat & inspect JSON trees, convert JSON/YAML/CSV/TOML, generate TypeScript/Zod, and beautify SQL/XML/HTML.
100% client-side — files and inputs never leave your browser.
About this tool and how it works
Formatting SQL, XML, and HTML
Queries copied from logs, ORMs, or monitoring tools usually arrive on a single line. This formatter breaks SQL into one clause per line (SELECT, FROM, JOIN, WHERE, GROUP BY, ORDER BY) and puts each AND/OR condition on its own indented line, so you can review the logic at a glance. For XML and HTML it re-indents nested tags; in minify mode it collapses whitespace between tags.
Typical uses
- Reading a slow query from a database log before running
EXPLAIN. - Reviewing SQL generated by an ORM to spot missing indexes or
N+1patterns. - Pretty-printing SOAP envelopes, RSS/Atom feeds, sitemaps, or SVG files.
- Minifying an HTML email snippet before pasting it into a template field.
Example
select id, name from users u join orders o on o.user_id = u.id where o.total > 100 and u.active = 1 order by name becomes a readable block with JOIN, WHERE, the AND condition, and ORDER BY each on their own line.
Limitations
This is a lightweight, dialect-agnostic formatter meant for reading code, not a full parser. It does not validate syntax, and minifying collapses repeated spaces everywhere — including inside string literals — so keep the original when whitespace inside quotes matters. For HTML, whitespace between inline elements can be visible; check the rendered result after minifying.
Frequently asked questions
Does the SQL formatter work for PostgreSQL and MySQL?
Yes. It formats by standard clause keywords, which are the same across PostgreSQL, MySQL, SQLite, and SQL Server for typical queries.
Will formatting change what my query does?
Formatting only adds line breaks and indentation between clauses. Minify mode collapses whitespace, which can alter string literals that contain multiple spaces.
Can it validate my XML?
It re-indents well-formed markup but is not a validator. Use an XML schema (XSD) validator when you need strict validation.
Other tools
Beautify, minify, validate with line errors, sort keys, and inspect JSONPath.
Convert bidirectionally between JSON, YAML, CSV, and TOML in your browser.
Generate TypeScript interfaces and Zod schemas from any JSON payload.
Live regex matcher, capture groups, replace preview, and quick presets.
Compare text, JSON, or code side-by-side or in unified diff view.
Convert camelCase/snake_case/slugs, count bytes/words, and deduplicate lines.
Live GFM preview, HTML export, and Markdown table generator from CSV/TSV.
Create direct wa.me links with pre-filled messages and downloadable PNG QR codes.
Merge, split, compress, rotate pages, and convert between PDF and images 100% locally.