SQL Prettifier
Format SQL with indentation and optional uppercase keywords; check quote and parenthesis balance.
Standard mode also covers MySQL NO_BACKSLASH_ESCAPES. PostgreSQL mode assumes standard_conforming_strings is on. Lexical SQL formatting preserves quoted text and comments. Checks quote and parenthesis balance; it does not validate database-specific SQL grammar.
SQL formatter that starts each major clause on its own line and indents inside parentheses, with optional uppercase keywords. It is lexical formatting: quoted text and comments are kept intact, unbalanced quotes or parentheses are reported, and SQL syntax is not checked.
See moreSee less about the SQL Prettifier
Examples
Clause layout
select id,name from users where id=1 โ SELECT id,name
FROM users
WHERE id=1Spacing comes from your input, so a comma without a space stays that way. Turn off Uppercase keywords to keep the original case.
Unbalanced input
select (id from users โ Unbalanced SQL parentheses.Quote and comment errors are reported too, such as Unterminated SQL quote. A misspelled keyword is not flagged, because syntax is not checked.
Key features
- Clause-based line breaks
- Uppercase keywords option
- 2 or 4 space indent
- Quote and parenthesis checks