BasicApps Logo
SQL Prettify

Format and beautify SQL queries with proper indentation

Sample SQL Queries

SQL Query

Formatted SQL

Formatted SQL will appear here as you type...

Real-time Formatting

Watch your SQL queries get formatted instantly as you type, with live preview in the right pane.

One-Click Copy

Copy your beautifully formatted SQL with a single click, ready to use in your projects.

Flexible Options

Customize keyword case, indentation style, and formatting preferences to match your coding standards.

Paste unformatted SQL and get clean, consistently indented output instantly

Paste any SQL query — one long line or a jumbled mix of cases — into the left editor. The formatter runs on every keystroke via a useEffect hook, so the right panel updates as you type without pressing any button. Three controls sit in the toolbar: Keyword Case sets keywords to UPPERCASE, lowercase, or leaves them as-is; Indent Style switches between standard, tabular-left, and tabular-right alignment; Indent Type chooses spaces or tabs with a configurable width. The formatter uses the sql-formatter library, which understands MySQL, PostgreSQL, T-SQL, and PL/SQL syntax.

Sample queries and download options

Four sample queries at the bottom of the page — Basic SELECT, JOIN, CTE with window functions, and a subquery — load immediately so you can see how the formatter handles different constructs before pasting your own SQL. When you're done, the Copy button sends the formatted result to your clipboard. Download SQL saves it as a timestamped .sql file; Download TXT saves the same content as plain text.