SQL Formatter & Beautifier

Pretty-print SQL in your dialect with consistent keyword casing and indentation, or squeeze it onto one line. Queries are formatted locally and never uploaded.

No data leaves your browser
SQL
Formatted

Frequently Asked Questions

Is my SQL sent to a server?

No. Formatting runs in your browser using the open-source sql-formatter library, served from this site. Queries containing table names or data never leave your machine.

Which SQL dialects are supported?

Standard SQL, PostgreSQL, MySQL, MariaDB, SQLite, BigQuery, Snowflake, Redshift, SQL Server (T-SQL), Oracle PL/SQL, DB2, Hive, Spark, Trino/Presto, DuckDB, SingleStore, TiDB and Couchbase N1QL.

Should SQL keywords be uppercase?

It's a convention, not a requirement: SQL keywords are case-insensitive. Uppercase keywords make queries easier to scan, which is why it's the default here, but you can preserve or lowercase them.

Why did formatting fail?

The formatter parses your query for the selected dialect. Dialect-specific syntax (for example backtick identifiers outside MySQL/BigQuery, or :: casts outside PostgreSQL) can fail in another dialect; pick the matching dialect or Standard SQL.

More Developer Tools

JSON ToolsFormat, validate, minify & compare JSON JSON FormatterPretty-print and beautify JSON CSV Viewer & EditorView, edit and convert CSV files YAML ConverterConvert YAML to JSON and back Regex TesterTest regular expressions live Text DiffCompare two texts side by side JWT ToolDecode, encode, compare and verify JWTs JWT DecoderInspect JWT header and payload XML FormatterFormat, validate and convert XML URL EncoderEncode, decode and parse URLs Base64Encode and decode Base64 strings Hash GeneratorSHA-256, MD5, HMAC and CRC32 SHA-256Generate SHA-256 checksums MD5 GeneratorGenerate MD5 hash values Text ToolsCase convert, count and transform text Number ConverterBinary, hex and octal converter Token CalculatorEstimate LLM token counts from text PDF EditorEdit text, sign and annotate PDFs Schema GeneratorJSON to TypeScript, Go, Rust, Python IndexNowSubmit URLs to Bing, Yandex & more PII RedactorMask personal data & keys before AI Timestamp ConverterUnix epoch to date and back UUID GeneratorUUID v4/v7, ULID, Nano ID Password GeneratorSecure passwords & passphrases MCP Config BuilderConfigs for Claude, Cursor, VS Code AGENTS.md GeneratorCLAUDE.md, Cursor rules, Copilot AI Crawler Controlsrobots.txt for AI bots & llms.txt Cron ParserExplain crontab, next run times SQL FormatterBeautify & minify SQL queries cURL ConvertercURL to fetch, Python, Go, PHP Chat Export ConverterChatGPT/Claude export to Markdown Markdown PreviewLive GFM preview & to HTML Color & ContrastHEX/RGB/OKLCH, WCAG checker QR Code GeneratorURL, Wi-Fi, vCard; PNG & SVG Tool Schema ConverterOpenAI ↔ Anthropic ↔ Gemini ↔ MCP JSONL ValidatorFine-tuning & batch files SSE Stream ParserReassemble LLM streaming responses Prompt Template & DiffFill {{vars}}, compare versions