SQL Formatter
Paste messy SQL and get properly indented, aligned output. Supports five dialects (PostgreSQL, MySQL, SQL Server, BigQuery, SQLite), configurable indentation, and keyword case (UPPER, lower, preserve). Runs entirely in your browser using the sql-formatter library — safe for internal queries with sensitive column names.
Today's picks
Three books for ticket and docs work. Check the current price before you buy.
Amazon affiliate links. We earn a commission on qualifying purchases at no extra cost to you.
Get new tools by email
We add tools most weeks. Give an email address and we send you the new ones, plus short notes on how to use them. No more than one email a week. Unsubscribe with one click.
Test your AI fundamentals next
If this tool is part of your AI or developer workflow, the free CloudYeti diagnostic shows which AWS AI concepts you already know and where you are weak.
Take the AI diagnosticFrequently Asked Questions
- Which SQL dialect should I pick?
- Match your actual database. PostgreSQL covers Postgres, Redshift, CockroachDB. MySQL covers MySQL, MariaDB, TiDB. SQL Server is T-SQL (SQL Server, Azure SQL). BigQuery has its own dialect. SQLite for embedded and mobile. Picking the wrong dialect usually still formats correctly but can misformat dialect-specific syntax like PostgreSQL arrays or BigQuery STRUCT literals.
- Does it rewrite my query or change its logic?
- No. Pure whitespace and case changes. The formatter preserves every token, comment, and literal exactly as written — it just reflows the query so it's readable.
- Why did my query fail to format?
- Either a syntax error in the source SQL (unbalanced parens, unterminated strings) or a dialect-specific construct the parser doesn't recognize. Try switching the dialect dropdown or fixing the source syntax.
- Is my SQL uploaded anywhere?
- No. Formatting runs in your browser. You can safely paste queries containing production table names, column names, or hardcoded values.
Related Tools
Add Emoji to Post
Add one or two well-placed emoji to a LinkedIn or X post — or strip every emoji out. Minimal by default, no emoji walls. Free, instant, in your browser.
LinkedIn Post Formatter
Free LinkedIn post formatter — select any words and make them bold, italic, underlined or strikethrough, with a live post preview showing where the “see more” fold cuts your post off.
Twitter/X Text Formatter
Free Twitter/X text formatter — make tweet text bold, italic, script, monospace and more using Unicode fonts. Works in tweets, bios, and replies. Type, copy, paste. No signup.
Instagram Font Generator
Free Instagram font generator and text formatter — make your bio and captions bold, italic, script, cursive and more with Unicode fonts. Copy and paste into Instagram. No app needed.
About SQL Formatter
Pretty-print SQL for PostgreSQL, MySQL, SQL Server, BigQuery, and SQLite. Fast, browser-based, no data leaves your machine. This tool runs entirely in your browser, so your content is not sent to a server. MarkdownMe provides free, fast, and reliable Markdown tools for developers, writers, and anyone who works with Markdown.