Format and beautify SQL queries online for free. Supports MySQL, PostgreSQL, SQL Server, Oracle, BigQuery, Snowflake and more. Runs in your browser — no uploads.
First time here? Paste your SQL query Your input is processed locally and disappears when you close the tab.
An ORM dumps a two-hundred-line query onto one line, a colleague pastes a WHERE clause with six nested conditions and no line breaks, and nobody can tell what it actually does. Our free sql formatter online turns that back into something a human can read — indented, aligned, and consistently capitalised.
Dialect matters more than people expect, so there are nineteen to choose from. T-SQL's bracketed identifiers, PostgreSQL's double-colon casts, and BigQuery's backticked table references are all valid SQL and all rejected by the wrong parser. Pick your database from the dropdown and the query formats correctly; if it fails, the error tells you the line and column rather than just refusing. As a mysql formatter, postgresql formatter, or t-sql formatter it behaves the way each of those engines expects.
Keywords can be uppercased, lowercased, or left exactly as you typed them, and indentation can be two spaces, four, or tabs to match your team's style. A compact mode collapses the formatted query back to a single line — useful for logs, config files, and embedding a query in code — while keeping the normalised spacing and casing.
Everything is parsed in your browser. That is worth caring about with SQL specifically: queries carry real table names, column names, and often literal values from production, none of which belong in a stranger's web form. Pair it with the JSON Formatter for API payloads, the CSV Viewer for query results, and the Diff Checker to compare two versions of a query.
Paste your SQL query
Pick the dialect that matches your database
Choose keyword casing and indent width
Read the formatted query
Copy it or download it as a .sql file