Minify SQL Online — Compress a Query to One Line
Format and beautify SQL queries or minify them to one line — entirely in your browser.
Result
This page opens the SQL formatter with minify mode already selected: paste a query, press the button and you get the whole statement collapsed to one line. Multi-line comments and -- line comments are removed, because they cannot survive on a single line, and every run of whitespace is reduced to a single space.
A one-line query is what you need when SQL travels as data rather than as code: embedding a statement in a JSON payload or YAML config, pasting it into a CLI flag, storing it in an environment variable, or comparing two queries in a log aggregator where line breaks add noise. Minified SQL is also slightly smaller — for a long analytical query with hundreds of lines of formatting the difference can reach 20–30% of the text size.
The minifier is not a blind whitespace regex: the query is tokenized first, so spaces inside string literals ('New York' stays 'New York'), quoted identifiers and parameters are preserved exactly. Everything runs locally in your browser — the query is never uploaded. Need the opposite direction? Switch the mode back to formatting and get a readable, indented version of the same query.