How to Make SQL Queries Neat and Easy to Read
Developer · Step-by-step guide · 5 steps · 2 min read
SQL is the language used to ask a database for data. Long queries are hard to read on one line. This tool breaks them into neat lines.
Open the SQL Formatter & Beautifier
In the pictures, orange letters like A show where to look. Each step tells you its letter.
Step 1: Paste your query
Paste your SQL into Enter SQL query. See A in the picture.
Step 2: Choose your database
Pick a Dialect. This is your database type, like MySQL or PostgreSQL. See B in the picture.
Step 3: Choose capital or small letters
Pick UPPER for words like SELECT, or lower. You can set the Indent too. See C in the picture.

Step 4: Press Format SQL
Or press Minify to put it on one line. Highlight Keywords adds colour. See D in the picture.
Step 5: Copy or download
The neat query shows on the right. Press Download to save it. See E in the picture.

Tips and questions
Does it change what my query does?
No. It only changes spaces, new lines and letter case. The query works the same.
Does it check my SQL for mistakes?
No. It is not a database. It cannot tell if a table exists. Run the query in your database to test it.
Why pick a database type?
Databases differ a little. Picking yours keeps the result correct for it.
Privacy
Your data is handled in your browser. It is never sent to us. So it is safe to paste private or work data.
Try it now
The SQL Formatter & Beautifier is free. You do not need an account.
Open the SQL Formatter & Beautifier