CodeForge
  1. Developer tools
  2. SQL Formatter

SQL formatter

Paste a long, single-line query and get readable SQL with consistent indentation and uppercase keywords — or squeeze it back onto one line. Formatting runs on your device, so queries containing real table names and data never leave it.

Free in your browser — no sign-up. Install from the Microsoft Store to use it offline on Windows 10 and 11.

How to use it

  1. Open the SQL Formatter and paste your query.
  2. Pick an indent — 2 spaces, 4 spaces or a tab — and press Format.
  3. Copy the result, or Minify it back to a single line.

Example

Input
select id, name, email from users where active = 1 and created_at > '2025-01-01' order by created_at desc limit 20;
Formatted
SELECT id,
  name,
  email
FROM users
WHERE active = 1
  AND created_at > '2025-01-01'
ORDER BY created_at DESC
LIMIT 20;

Features

Frequently asked questions

Is my SQL sent anywhere?

Formatting and minifying run locally. A query only leaves your device if you click AI Explain or AI Optimize.

Which databases does it support?

It formats standard SQL syntax and recognises keywords used across MySQL, PostgreSQL, SQL Server and SQLite, including MySQL-style backtick identifiers.

Is the SQL formatter free?

Yes. Format and minify are free. Pro adds the SQL INSERT generator, which turns CSV or JSON into batched INSERT statements.

Related tools

JSON FormatterFormat, validate and minify JSON.Text DiffCompare two texts line by line.Case ConvertercamelCase, snake_case, kebab-case and more.JSON to TypeScriptGenerate TypeScript, Zod, Go and more from JSON.

One workspace for all of it

SQL Formatter is one of 18 developer tools in CodeForge — alongside a JSON formatter, JWT decoder, regex tester, UUID and hash generators, and more. Press Ctrl+K to jump to any of them.

Open SQL Formatter — free Get the Windows app

Free in your browser — no sign-up. Install from the Microsoft Store to use it offline on Windows 10 and 11.