Nouplo

SQL formatter

A query you can read, from one you were handed.

Examples temporarily replace the input and settings. You can restore your previous work.

0 characters
Output
Paste or type above to see the result here.

Your files stay on your device

This tool runs entirely in your browser. What you paste is processed on your device and is never sent to a server, so it is safe to use with tokens, keys and unpublished text.

Example

Worked example — SQL formatter

Use the input lines in order and the settings below. Compare your result with the output rows.

Item Value
Input 1 select name,age from people where age>=18 order by name;
Keywords UPPERCASE
Indent Two spaces
One column per line under SELECT On
Output 1 SELECT
Output 2 name,
Output 3 age
Output 4 FROM people
Output 5 WHERE age >= 18
Output 6 ORDER BY name;

Keywords become uppercase and the two selected columns get separate lines. Formatting does not execute the query.

How it works

  1. Paste the SQL.
  2. Choose how keywords are written and how far each level is indented.
  3. Copy the result, or keep editing: it is laid out again as you type.

Frequently asked questions

Will it break a query it does not understand?
It does not try to understand it. The text is split into words, strings and comments and laid out by clause, so a half-written query, a dialect it has never seen or a stored procedure all come back formatted rather than refused.
Are my strings and comments safe?
Yes. Anything in quotes, backticks or brackets, and every -- or /* */ comment, is carried through character for character.
Is the SQL sent anywhere?
No. It is formatted in your browser as you type, which matters when the query has real table names in it.

Related tools