SQL Formatter

Beautify messy SQL — keywords uppercased, clauses indented

No matches

Input SQL

Formatted

Free Online Tool

SQL Formatter — Complete Guide & Instructions

MakeCard SQL Formatter takes a cramped, one-line SQL query and returns it as properly indented, readable code — keywords uppercased, clauses broken onto their own lines, four-space indentation. Six dialects are supported: Standard SQL, MySQL, PostgreSQL, SQLite, MariaDB, and Oracle PL/SQL, powered by the sql-formatter library. Ideal for developers, analysts, and DBAs reviewing inherited or generated queries.

How to Use SQL Formatter

  1. 1 Pick your database dialect from the dropdown — Standard SQL, MySQL, PostgreSQL, SQLite, MariaDB, or PL/SQL.
  2. 2 Paste the query into the Input SQL box (or press "Load sample" to try one).
  3. 3 Click "Format".
  4. 4 Read the indented result in the Formatted panel and press "Copy" to take it to your editor.

Key Features & Capabilities

  • Six SQL dialects — Standard, MySQL, PostgreSQL, SQLite, MariaDB, and Oracle PL/SQL.
  • Keywords uppercased automatically for consistent style.
  • Four-space indentation with clauses like SELECT, FROM, WHERE, JOIN, GROUP BY on separate lines.
  • Handles nested subqueries, joins, CASE blocks, and window functions.
  • Side-by-side input/output panes with one-click copy.
  • Load sample button drops in a real join query to demo instantly.

Supported Formats & Specifications

Parameter Specification
Dialects sql (standard), mysql, postgresql, sqlite, mariadb, plsql
Formatting keywordCase: upper, tabWidth: 4 — via the sql-formatter library
Input Any length of pasted SQL text
Output Beautified query in a read-only pane, copy to clipboard
Processing 100% client-side formatting

Practical Everyday Use Cases

  • Making an ORM-generated one-line query readable for debugging.
  • Standardizing query style before committing to a repository.
  • Re-indenting a legacy stored procedure for review.
  • Formatting SQL for documentation, blogs, or teaching material.
  • Beautifying a slow query before analyzing its execution plan.

Pro Tips for Best Results

  • Choose the correct dialect — backtick quoting and vendor functions only parse correctly under their own dialect.
  • Format before debugging: aligned clauses make missing JOIN conditions obvious.
  • Use it alongside the SQL Minifier to go the other direction for logs or URLs.
  • If formatting fails, check for unterminated string literals — the parser reports syntax errors.

Common Problems & Solutions

The query has a syntax problem — usually an unclosed quote or unsupported vendor syntax; try the Standard SQL dialect as a fallback.

Switch the dialect dropdown to match your database — MySQL backticks and PL/SQL constructs parse only under the right dialect.

The formatter preserves most comments, but exotic hint syntax can move — review the output before copying.

Privacy & Security

100% Client-Side Execution

Formatting happens entirely in your browser using a JavaScript library — your queries are never sent to a server.

No server uploads No data logging Safe for personal documents
FAQ Section

Frequently Asked Questions

Everything you need to know about using SQL Formatter

Paste the query into this tool, pick your database dialect, and press Format — you get cleanly indented SQL with uppercased keywords that you can copy back.

Standard SQL, MySQL, PostgreSQL, SQLite, MariaDB, and Oracle PL/SQL — select yours from the dropdown so vendor-specific syntax parses correctly.

No — formatting is done by the sql-formatter library running in your browser. The query text never leaves your device.

No — it only changes whitespace, line breaks, and keyword case. The query executes identically.

Related FreeToolsBazaar Tools

Ready to Use SQL Formatter?

100% free, browser-based, and private. No installation, registration, or file upload to external servers required.

Start Using SQL Formatter