SQL Formatter / Beautifier
Format and beautify SQL queries with dialect awareness (MySQL, PostgreSQL, SQLite, SQL Server, ANSI), keyword casing, indentation, comma style, and SELECT-column alignment. Pure in-browser; no network. 100% client-side.
About SQL Formatter / Beautifier
Format and beautify SQL queries with dialect awareness (MySQL, PostgreSQL, SQLite, SQL Server, ANSI), keyword casing, indentation, comma style, and SELECT-column alignment. Pure in-browser; no network. 100% client-side. Everything runs locally in your browser — your data never leaves your device.
How to use
- Enter your input in the tool above.
- Adjust any options to your preference.
- Use the Copy or Download buttons to save the result.
- Everything happens locally — your data never leaves your browser.
FAQ
Which SQL dialects does this formatter support?
ANSI SQL (the standard baseline), MySQL/MariaDB, PostgreSQL, SQLite, and SQL Server (T-SQL). Dialect selection mainly controls how quoted identifiers (backticks, double-quotes, [brackets]) and vendor comments (--, #, /* */) are tokenized so the formatter never corrupts your code.
What style options can I control?
Keyword case (UPPER / lower / preserve), identifier case (preserve / upper / lower), indent style (spaces or tabs) and width, comma placement (trailing or leading), newline before major clauses (SELECT, FROM, WHERE, JOIN, GROUP BY, ORDER BY, etc.), and SELECT-column alignment. Presets ship for popular styles (dbt, Poor-Man's-TSQL, pgcrypto-friendly).
Does the formatter change the meaning of my SQL?
No. We never reorder, add, or remove tokens. String literals ('…', "…", `…`, […]) and comments (-- line, # MySQL, /* block */) are preserved verbatim. Only whitespace, newlines, indentation, and keyword casing change. Run it through the in-tool diff to verify before/after are semantically identical.
Are my queries uploaded to a server?
Never. This is a 100% client-side formatter — your SQL never leaves the browser. History (last 20 operations) is stored in localStorage on this device only, and a shareable URL encodes your options in the fragment (after #), which browsers never send to servers.
What extra features does this tool have versus others?
(1) Five dialect presets. (2) Keyword + identifier case control. (3) Spaces or tabs indent with custom width. (4) Leading or trailing comma style. (5) SELECT-column alignment. (6) Comment preservation (-- # /* */). (7) String-literal safety (single, double, backtick, bracket). (8) Live before/after stats (chars, lines, tokens). (9) Saveable named presets + shareable-URL config. (10) localStorage history (max 20). (11) Copy / download .sql. (12) One-click sample SQL.
Related tools
.bashrc / .zshrc Alias & Config Manager
Build shell aliases, functions, exports, and PATH edits in a visual editor, then export a clean, commented .aliases file sourced from both .bashrc and .zshrc — with shadowing detection against shell builtins and common CLI tools, function suggestions when args are needed, starter packs (git, docker, kubectl, navigation, safety, ls, dev, devops, data science), import of existing rc files, dedupe, history (localStorage), and shareable URL. 100% client-side.
Add / Subtract Date Calculator
Add or subtract years, months, weeks, days, hours, minutes and seconds from a starting date/time. Calendar-day or business-day mode with custom weekend + holiday list. Month-end policy toggle (clamp to last day vs overflow). Repeat/series mode (e.g. every 2 weeks x 10) with CSV export. Shareable URL. 100% client-side.
Age Calculator
Calculate exact age from a birth date in calendar years/months/days (no negative-day bugs) plus totals in months/weeks/days/hours/minutes/seconds. Next-birthday countdown with weekday. Feb-29 birthday policy toggle. Milestones (1,000 days, 10,000 days, 1 billion seconds). Zodiac sign + Chinese zodiac. Age gap comparison. Shareable URL. 100% client-side.