Omnikit
DevFilesMoneyAll tools
Ctrl K
Dev toolsFile toolsMoney calculatorsAll tools
HomeDeveloper toolsSQL Formatter
EnglishالعربيةবাংলাDeutschEspañolFrançaisPolskiPortuguêsРусский

SQL Formatter

dev

Format and beautify SQL for PostgreSQL, MySQL, SQL Server and more

Runs in your browser. Nothing you type is sent anywhere. Updated on 24 Oct 2026.

An unformatted query stops being readable the moment it passes 20 lines. This indents SQL for PostgreSQL, MySQL, SQL Server and other dialects, aligning clauses so joins and conditions line up. The query is formatted in your browser, so production SQL is never sent anywhere.

Next:
  • SQL to JSON Converter Turn SQL INSERT statements or a database dump into JSON or CSV, table by table
  • JSON to SQL Converter JSON to CREATE TABLE and INSERT statements for PostgreSQL, MySQL, SQLite or SQL Server

How to format a SQL query

1

Pick your database under Dialect.

2

Paste the query into the SQL pane, or click Try an example.

3

Choose UPPER, lower or As typed for Keywords and an Indent width; Minify puts it on one line instead.

4

Click Copy, or the download icon to save a .sql file.

About the SQL Formatter

This SQL formatter takes a query of any length and lays it out so it can be read: every clause on its own line, selected columns listed one per line, joins and conditions indented, and keywords in the case you prefer. Paste on the left and the formatted SQL appears on the right as you type.

It helps whenever SQL reaches you in a form nobody wrote by hand. A query captured from an ORM log or a slow-query report arrives as one long line; a colleague's view definition has inconsistent indentation; a report from a BI tool nests three subqueries without a single line break. Formatting first makes a code review or a performance investigation much faster.

Choose the dialect so its own syntax is understood: PostgreSQL casts and dollar-quoted bodies, MySQL backtick names, SQL Server square brackets and TOP, BigQuery project paths, SQLite, or standard SQL. Pick upper, lower or unchanged keyword case, two spaces, four spaces or tabs, or minify the query back onto one line without comments for embedding in code.

If the formatter cannot read the query, you get the line and column and a plain hint, such as a string that is never closed or a query that ends too early, instead of a wall of parser output. Formatting only changes layout and case; it never changes what the query does. Everything runs in your browser, so queries containing table names or customer data never leave your device. Related tools: JSON Formatter, Diff Checker.

Frequently asked questions

Is this SQL formatter free?

Yes, free with no signup, no account and no limit on query length or on how many queries you format. The page is supported by a few ads shown outside the tool, never inside the editor, and no dialect or option is held back for a paid tier.

Is my SQL sent to a server?

No. Formatting runs in your browser with JavaScript, so a query never leaves your device. Table names, connection strings and customer data inside the SQL stay local, and nothing is logged. Only the four settings you chose, dialect, keyword case, indent and minify, are remembered on this device.

Which databases does it support?

Six dialects: PostgreSQL, MySQL, SQLite, SQL Server (T-SQL), BigQuery and standard SQL. Choosing the right one lets the formatter understand syntax that belongs to that database, such as PostgreSQL :: casts, MySQL backtick names, SQL Server square brackets and TOP, and BigQuery backtick-quoted table paths.

Can I make SQL keywords upper case?

Yes. Choose Upper to write SELECT, FROM and functions such as COUNT in capitals, Lower for lower case, or Preserve to keep the case you typed. Table and column names are never changed.

Does formatting change what my query does?

No. Only whitespace, line breaks and the case of keywords change, so the query you get back runs exactly as the one you pasted. Strings, quoted identifiers and values are copied character for character. Minify also strips comments, which is the one change worth noticing before you commit the result.

Why does it say my query ends too early?

The formatter reached the end while a bracket or clause was still open, for example WHERE with no condition or a ( with no matching ). Check the end of the query, or switch the dialect if the syntax belongs to another database.

Still stuck? Ask about SQL Formatter and anybody who knows can answer. No account needed.

Also works as: SQL Beautifier.

Same job, other tools: JavaScript Beautifier – Reformat JavaScript with Prettier, in the indent style you use · GraphQL Validator – Check a GraphQL query or schema for errors, optionally against your own SDL · JSON Minifier – Strip whitespace from JSON for production · HTML Minifier – Strip comments and spare whitespace from HTML and see the saving · CSS Minifier – Compress a stylesheet and see exactly how many bytes you saved.

On the related tools: Markdown to HTML – Convert Markdown into clean, safe HTML you can paste anywhere.

Related tools

All developer tools
Hex Viewer (xxd online)See any file as an xxd hex dump with offsets and text, or turn a hex dump back into a fileGraphQL FormatterFormat, minify and validate GraphQL queries and schemas, with errors by line and columnJSONL Viewer and ValidatorCheck JSON Lines and NDJSON line by line, view records as a table, convert to a JSON arrayJSON Formatter & ValidatorFormat, validate, minify and sort JSON with exact error positionsMarkdown PreviewWrite Markdown and see it rendered live, with tables, task lists and codeHTML Formatter & MinifierIndent messy HTML, or minify it and see the bytes you savedCSS Beautifier & MinifierTidy a stylesheet or minify it, with the size saved shownJavaScript Beautifier & MinifierBeautify JavaScript, or minify it and see how many bytes went

In the collection Code Formatters and Minifiers.

Was this tool helpful?
Omnikit

Small jobs, done in your browser. Free, fast and private. Files are never uploaded.

Files

  • Compress Image
  • Image to PDF
  • Merge PDF
  • Compress PDF
  • PDF to Word
  • Word to PDF

Dev

  • JSON Formatter & Validator
  • Base64 Encode & Decode
  • JWT Decoder, Verifier & Encoder
  • Password Generator
  • UUID Generator
  • Unix Timestamp Converter

Money

  • SIP Calculator
  • EMI Calculator
  • GST Calculator
  • FD Calculator
  • PPF Calculator
  • Lumpsum Calculator
EnglishالعربيةবাংলাDeutschEspañolFrançaisPolskiPortuguêsРусский
GuidesQuestionsAboutHow we checkLaw library (beta)PrivacyTermsDisclosureContactMore: Exam practice (UGC NET Paper 1)Runs in your browser. Nothing is uploaded. © 2026 Omnikit (theomnikit.com)