Skip to content

SQL Prettify and Format

Reformat a SQL query onto multiple lines with uppercase keywords, making it easier to read and review.

Category: development
Use Case: Formatting a Query for a Pull Request, Making a Long Query Readable, Standardizing Keyword Casing
Privacy: 100% browser-based

This is a lightweight, pattern-based formatter for common SQL - it doesn't fully parse SQL syntax, so deeply nested subqueries or unusual dialects may not format perfectly.

Input SQL

Formatted SQL

Recommended Settings

Pro Tips

  • Major clauses (SELECT, FROM, WHERE, JOIN, ORDER BY, and similar) are each placed on their own line for easy scanning
  • All recognized SQL keywords are uppercased, following the common convention that distinguishes keywords from table and column names
  • Comma-separated columns in a SELECT list are placed on their own indented lines for long column lists
  • For complex queries with deeply nested subqueries or vendor-specific syntax, review the output carefully since this is a lightweight formatter, not a full SQL parser

Most Popular

Most developers use this to quickly clean up a query before pasting it into a pull request or documentation

When to Use This Tool

Formatting a Query for a Pull Request

Clean up a query's formatting before including it in code review or documentation.

Making a Long Query Readable

Break a dense, single-line query into a clearly structured, multi-line format.

Standardizing Keyword Casing

Uppercase SQL keywords consistently across a codebase or document.

Reviewing a Query Copied from a Tool

Reformat a query exported from a database tool into a more readable layout.

How It Works

1

Normalize whitespace and uppercase recognized SQL keywords

2

Insert a line break before each major clause (SELECT, FROM, WHERE, JOIN, ORDER BY, and similar)

3

Indent comma-separated items in lists, then clean up any resulting blank lines

100% Private

Files never leave your device. All processing happens locally in your browser.

Lightning Fast

Powered by Client-side pattern-based SQL formatting for optimal performance on modern browsers.

Open Source

Built with verified, open-source libraries. Fully transparent.

Frequently Asked Questions

Does this validate my SQL syntax?

No, this formats SQL text based on keyword patterns - it doesn't parse or validate query correctness, so invalid SQL may still 'format' without any warning.

Does this work with all SQL dialects?

It handles standard, widely used SQL keywords well, but vendor-specific syntax (like some Oracle, T-SQL, or PostgreSQL extensions) may not be recognized and formatted as expected.

Will this change my query's behavior?

No, only whitespace, line breaks, and keyword casing are changed - the actual query logic and identifiers are left untouched.

Is my SQL sent to a server?

No. All formatting happens locally in your browser.