Developer

Processed locally

SQL Formatter

Format, beautify, and standardize raw SQL queries with proper clause indentation, capitalized keywords, and structured line breaks.

Tool options · presets, sharing & more

Presets & sharing: options only, never files, text or passwords. Undo/redo: editable form values, not file selection or generated results.

How to Use SQL Formatter

1

Paste your unformatted or minified SQL query.

2

Choose your SQL dialect (PostgreSQL, MySQL, SQLite, Transact-SQL).

3

Click 'Format SQL' to beautify the query.

4

Copy the formatted SQL into your database client or migration files.

What This Tool Does

Tokenizes SQL keywords (SELECT, FROM, WHERE, JOIN, GROUP BY), aligns query clauses, and standardizes indentation for human readability.

Common Use Cases

Cleaning messy ORM queries and database execution plans.
Formatting complex analytical queries and subqueries for code review.
Standardizing SQL migrations across a development team.
Privacy & Processing

This tool processes files and input in this browser tab. Its processing code does not upload them to a server. Loading this page and fetching uncached app files uses an internet connection. Optional usage analytics requires your consent and excludes input, filenames, passwords and generated content. Form undo history and result transfers stay in session memory. Explicitly saved presets contain approved settings only.

Offline use is not verified for this tool. Keep an internet connection available to load its page, code and any additional dependencies.

Frequently Asked Questions

Does it support modern SQL clauses like CTEs (WITH)?

Yes, Common Table Expressions, window functions, and subqueries are formatted with clean hierarchical indentation.

Does this tool work offline?

Offline use is not verified for this tool. Keep an internet connection available to load its page, code and any additional dependencies.