The SQL formatter makes long queries readable: each clause (SELECT, FROM, JOIN, WHERE, GROUP BY) starts on its own line, columns go one per line and subqueries are indented. It can also minify SQL into one line. Strings and comments are preserved and nothing is sent to a server.
How to use
- Paste your SQL query.
- Choose keyword case and indentation.
- Click Format SQL or Minify and copy the result.
Frequently asked questions
Which databases does it support?
The common SQL of MySQL, MariaDB, PostgreSQL, SQL Server, Oracle and SQLite, including brackets, backticks and double-quoted names.
Does it fix errors in the query?
No. It only rearranges the text. A syntax error stays an error.
Can I format several statements at once?
Yes. Separate them with semicolons; each one is formatted on its own.
Related tools
- JSON FormatterFormat, validate, or minify JSON structures.
- Base64Encode or decode text using Base64.
- JWT DecoderView a JWT header and payload. The signature is not validated.
- Timestamp ConverterConvert Unix timestamps to date and time, and vice versa.
- Regex testerTest JavaScript regular expressions.
- HTTP Status CodesLook up common HTTP status codes.
- Text to HTMLConvert text to HTML, escape entities or extract text from HTML.
- Character infoSee the Unicode code point, UTF-8 and escapes of each character.
- SQL GeneratorBuild SELECT, INSERT, UPDATE, DELETE, UPSERT and CREATE TABLE for your database from fields, data or a class.