ConvertBox Logo
ConvertBox

SQL Formatter

Format SQL queries with readable indentation and line breaks, making SELECT, JOIN, WHERE, and INSERT statements easier to review.

How to Use

  1. Paste your SQL into the input area (even single-line queries generated by an ORM like Prisma or Hibernate)
  2. Choose the indent width: 2 spaces for pasting into Slack or Notion; 4 spaces for code review on GitHub or GitLab
  3. Click "Format SQL" β€” everything runs in your browser, no SQL is sent to an external server
  4. The result splits SELECT, FROM, JOIN, WHERE, GROUP BY, and ORDER BY onto separate lines with consistent indentation for subqueries and CTEs
  5. Copy the result to your clipboard and paste it into DBeaver, DataGrip, pgAdmin, Navicat, or a Jira ticket
  6. Take the formatted query into `EXPLAIN ANALYZE` on your database to spot bottlenecks in BI reports or ETL pipelines

All processing is done in your browser, and files are never sent to a server.

Frequently Asked Questions

The formatter supports standard SQL syntax that works with MySQL, PostgreSQL, SQL Server, and other major databases.
No, formatting only adds indentation and line breaks for readability. The query logic remains unchanged.
Yes, it handles JOINs, subqueries, CTEs, and other complex SQL structures.
Yes. UTF-8 comments and quoted string literals (CJK, Cyrillic, accents) are preserved verbatim.
No. Formatting runs locally in your browser β€” safe for production queries containing column names or business logic.
Yes. Common Table Expressions, window functions, and recursive queries are all formatted with proper indentation.
Yes β€” pick 2 spaces, 4 spaces, or tabs to align with your style guide.