Skip to content

Install ALink Tools

Free browser tools for images, PDFs, media, text and web checks. Most tools process files locally on your device.

  1. Tap the Share button in the Safari toolbar.
  2. Scroll down and tap Add to Home Screen.
  3. Tap Add. ALink Tools then opens from your Home Screen like an app.

SQL Formatter

Indent a query so it is readable. Pick the dialect that matches your database. The query is not run, explained or linted — it is only reprinted.

Runs in your browsersql-formatter (MIT)Runs in your browser
1

SQL and dialect

Limits

  • The input is limited to 2 MB of UTF-8 text (8 MB if you load a file). Larger files can run out of memory in a phone browser tab.
  • Not a SQL executor, linter or migration tool. Nothing is sent to a database.
  • Dialect coverage is whatever sql-formatter implements. Procedural blocks (PL/pgSQL, T-SQL batches with unusual GO usage) may format poorly.
  • Keyword casing follows the library’s style and may not match your house style.
  • A query that does not parse in the chosen dialect will return an error instead of a best-effort indent.
2

Formatted SQL

How to use SQL Formatter

  1. Paste a queryType, paste or load a .sql file.
  2. Pick a dialectStandard SQL, MySQL, MariaDB, PostgreSQL, SQLite, Transact-SQL (SQL Server) or others supported by sql-formatter.
  3. Copy or downloadCopy the result or download a .sql file.

Formatting is not execution

sql-formatter (MIT) parses your query for the selected dialect and reprints it with consistent indent and keyword casing. Dialects differ: a PostgreSQL-only operator may not format well if you leave the dialect on MySQL, and the other way around.

The query never runs. There is no connection to a database, no EXPLAIN, and no guarantee that a reformatted query is accepted by your server.

Frequently asked questions

Is my text or file uploaded?

No. Everything runs in your browser tab with JavaScript. Nothing you type, paste or drop is sent to a server, logged or stored by ALink Tools.

Which dialect should I pick?

The one your database actually uses. If you are unsure, start with the generic SQL option and switch if the formatter reports a parse error.

Will this change the meaning of my query?

It should only change whitespace and casing. If a parse fails, the original text is not replaced. Still, review the result before you run it.

Can I format several statements at once?

Yes, if they parse as a script in the chosen dialect. A trailing semicolon style depends on the library.

Related tools

All tools