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
- XML FormatterFormat, indent, and validate XML documents. Detects malformed tags, unclosed elements, and bad attributes with clear line-level error messages. Great for config and API work.
- YAML FormatterFormat and validate YAML for config files, Kubernetes manifests, Docker Compose, and CI pipelines. Normalizes indentation and surfaces syntax errors.
- JSON FormatterPretty-print, minify, and validate JSON. Detects syntax errors with line numbers and supports nested structures of any depth.
- 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.