SQL Prettifier
Format SQL in your browser: keywords are upper-cased and each clause starts on its own line. Strings and comments are preserved, never reflowed.
What this sql prettifier does
The formatter tokenises the query first, so a keyword inside a string literal or a comment is never upper-cased or moved. It rejects an unterminated string or an unbalanced parenthesis instead of guessing, because a query that looks formatted but no longer parses is worse than the original.
How to use it
SQL Prettifier: paste the SQL into the box above, and press Run to get the formatted SQL below.
Worked example
Input:
select id, name from users where active = 1 order by name limit 10
Output:
SELECT id, name
FROM users
WHERE active = 1
ORDER BY name
LIMIT 10
Why it runs in your browser
The conversion happens on this page with JavaScript. Your input is not posted to a server, so it works offline after the page loads and nothing is retained anywhere. The page reads SQL and returns formatted SQL; reloading the page discards both.
The formatter tokenises the query first, so a keyword inside a string literal or a comment is never upper-cased or moved. It rejects an unterminated string or an unbalanced parenthesis instead of guessing, because a query that looks formatted but no longer parses is worse than the original.
Format SQL in your browser: keywords are upper-cased and each clause starts on its own line. Strings and comments are preserved, never reflowed.
How to use it
SQL Prettifier: paste the SQL into the box above, and press Run to get the formatted SQL below.
Why it runs in your browser
The conversion happens on this page with JavaScript. Your input is not posted to a server, so it works offline after the page loads and nothing is retained anywhere. The page reads SQL and returns formatted SQL; reloading the page discards both.
What to Expect
Best for
- Converting SQL to formatted SQL when the data is already on screen.
What this tool keeps
- Your input is not posted to a server, so it works offline after the page loads and nothing is retained anywhere.
Sample input
select id, name from users where active = 1 order by name limit 10
Sample output
SELECT id, name FROM users WHERE active = 1 ORDER BY name LIMIT 10
Frequently asked questions
How do I use the sql prettifier?
SQL Prettifier: paste the SQL into the box above, and press Run to get the formatted SQL below.
Is my input uploaded?
No. The text is parsed on this page with JavaScript and is never posted to a server.
Is there a size limit?
Yes: 5 MB per run. Larger input is refused with a message rather than freezing the tab.
Build custom tools for your store
Join the SDK program to create useful ecommerce utilities for your store.