Skip to content
kitty/binDev
Your queries stay on this device

Squeeze SQL onto one line

Paste a query and get it back on a single line, with comments and spare spaces gone and every string left exactly as written.

Keywords

What gets formatted

SELECT, FROM, WHERE, GROUP BY, HAVING, ORDER BY and LIMIT each start a new line, with their contents indented underneath. Every kind of JOIN lines up under FROM, AND and OR conditions get their own lines, CASE expressions are laid out WHEN by WHEN, and subqueries and WITH clauses are indented as blocks. INSERT, UPDATE, DELETE and CREATE TABLE work too, with one column definition per line.

Safe for any database

The formatter only changes whitespace and keyword case. Strings, quoted names in double quotes, backticks or square brackets, comments, placeholders like $1, ? and :name, and Postgres casts like ::int are left exactly as written, so it works for PostgreSQL, MySQL, SQLite, SQL Server, Oracle, BigQuery and Snowflake queries alike.

When to minify

Minify removes comments and extra spaces to put a query on a single line, which is handy for log searches, environment variables, JSON payloads or code that builds a query string. Spaces inside strings are never touched.

more in the bin

Keep going.

More in kittybin Dev

Explore the bin