SQL Formatter
Pretty-print and format SQL for any major dialect — MySQL, PostgreSQL, SQLite, T-SQL, and more. Normalizes indentation, keywords, and spacing for readable, consistent queries.
How to use the sql formatter
Pick the dialect that matches your database, paste the SQL, and the formatted version updates instantly.
Formula & explanation
Uses sql-formatter, a syntax-aware SQL beautifier supporting 12 dialects. Keyword case and indentation are configurable.
Examples
Inline 200-char queries become readable multi-line statements with consistent indent.
Frequently asked questions
- Which dialect should I pick?
- Match your database. 'sql' is generic ANSI; 'postgresql' is a safe default for unknown dialects.
- Does this run my SQL?
- No — it only formats. Nothing is sent anywhere.
Related developer tools tools
- Base64 Encoder/DecoderEncode text or binary data to Base64 and decode Base64 strings back to text. Supports standard and URL-safe Base64. Useful for data URIs, API tokens, and email attachments.
- String Escape/UnescapeEscape and unescape strings for JSON, JavaScript, HTML, and SQL. Handles special characters, backslashes, quotes, newlines, and Unicode escape sequences instantly.
- HTML EditorWrite HTML with live preview side-by-side. Syntax-highlighted editor with formatted source view — useful for testing snippets, email templates, or quick mockups in your browser.
- Markdown PreviewLive markdown editor with GitHub-flavored rendering. Supports tables, code blocks, task lists, and strikethrough. Great for drafting README files or documentation.
- CSS MinifierMinify CSS for production by stripping whitespace, comments, and redundant rules. Paste your stylesheet and get the compressed output ready to ship or inline.
- JS MinifierMinify JavaScript using Terser — removes whitespace, shortens variable names, and removes dead code. Paste your JS and get a production-ready compressed bundle.