SQL Formatter

Format, beautify, and minify SQL queries instantly. Supports SELECT, INSERT, UPDATE, DELETE, and more. Free, browser-based.

100% Client-Side Your data never leaves your browser Free · No Sign-Up

How to Use

  1. Paste your SQL query into the input area.
  2. Click Format to beautify or Minify to compress.
  3. Adjust indent size and keyword casing with the options.
  4. Click Copy to copy the formatted result.

Worked Examples

Before formatting

select u.id, u.name, o.total from users u join orders o on u.id = o.user_id where o.total > 100 and u.active = 1 order by o.total desc limit 10;

After formatting

SELECT
  u.id,
  u.name,
  o.total
FROM users u
JOIN orders o ON u.id = o.user_id
WHERE
  o.total > 100
  AND u.active = 1
ORDER BY o.total DESC
LIMIT 10;

Why Format SQL?

Formatted SQL is easier to read, review, and debug. Consistent formatting helps teams maintain coding standards and makes complex queries with multiple JOINs and subqueries much more manageable.

FAQ

What SQL dialects are supported?

The formatter handles standard SQL syntax including SELECT, INSERT, UPDATE, DELETE, CREATE TABLE, JOINs, subqueries, and CTEs. It works well with MySQL, PostgreSQL, SQLite, and SQL Server queries.

Does it validate my SQL?

This tool focuses on formatting, not validation. It will beautify the structure of your query but does not check for syntax errors or schema correctness.

Can I customize the formatting?

Yes. You can choose between 2-space, 4-space, or tab indentation, and toggle uppercase keywords on or off.

Is my data sent anywhere?

No. All formatting runs 100% in your browser using JavaScript. Your SQL never leaves your machine.