Developer Tools

SQLite Query Formatter

Format SQLite queries with the SQLite grammar and catch the statements that fail in SQLite but work elsewhere. The checker knows which features SQLite lacks, such as NOW(), ILIKE, TRUNCATE and changing columns with ALTER TABLE, and which ones need a recent version: RIGHT and FULL JOIN (3.39), RETURNING (3.35) and concat() (3.44).

  • Runs in your browser
  • No sign-up
  • Free to use

How to use SQLite Query Formatter

  1. Paste your SQLite query.
  2. Choose keyword case and indentation.
  3. Click Format and read the compatibility notes.
  4. Copy the formatted SQL into your app or migration.

SQLite Query Formatter features

SQLite grammar

json_extract, strftime, UPSERT, window functions and more.

Missing features

NOW(), ILIKE, TRUNCATE, ALTER COLUMN and MODIFY are flagged.

Version hints

RIGHT/FULL JOIN, RETURNING and concat() need recent SQLite.

Equivalents

datetime('now'), strftime, group_concat and DELETE FROM suggested.

Safety check

UPDATE or DELETE without WHERE, = NULL and NOT IN pitfalls.

Local

Nothing is executed or uploaded.

When to use SQLite Query Formatter

  • Formatting queries in mobile and desktop apps that embed SQLite.
  • Moving a schema or queries from MySQL or PostgreSQL to SQLite.
  • Checking which SQLite version a query needs.
  • Writing readable migration scripts for local databases.

SQLite Query Formatter FAQ

Why is ALTER TABLE … MODIFY flagged?

SQLite’s ALTER TABLE can add, rename and drop columns, but not change a column’s type or constraints. The documented way is to create a new table, copy the data and rename it; the SQL ALTER TABLE Generator writes that script.

What replaces NOW()?

CURRENT_TIMESTAMP or datetime('now') return the current UTC time as text.

Which SQLite version do I have?

Run SELECT sqlite_version(); Android, iOS and many languages ship their own version.

Is LIKE case-insensitive?

Yes for ASCII letters, which is why ILIKE does not exist. For other letters, compare lower() values or use a collation.

Does formatting change the query?

No, only whitespace and keyword case.

Is anything uploaded?

No. The formatter runs in your browser.

SQLite’s SQL

SQLite is the most widely deployed database in the world, embedded in phones, browsers and countless applications. Its SQL is close to the standard but deliberately small, and its feature set depends on the version compiled into each application. Queries that work in a server database or in a newer SQLite can fail in the copy your app ships with.

The formatter uses SQLite’s grammar from the sql-formatter library, which knows functions such as json_extract and strftime and statements such as INSERT … ON CONFLICT DO UPDATE. Formatting changes only layout and keyword case.

The compatibility check covers two groups. The first is syntax SQLite never had: NOW(), GETDATE() and CURDATE() for the current time, ILIKE, TRUNCATE TABLE, TOP, AUTO_INCREMENT, ON DUPLICATE KEY UPDATE, DATE_FORMAT and STRING_AGG, and ALTER TABLE commands that change existing columns. Each message names the SQLite way of doing it.

The second group is features added in recent years. RETURNING arrived in version 3.35 (2021), RIGHT and FULL OUTER JOIN in 3.39 (2022) and the concat() function in 3.44 (2023). If your application runs on older devices or bundles an older SQLite, these queries fail at runtime, so the checker tells you which version each feature needs.

General checks apply as everywhere: UPDATE and DELETE statements without WHERE, comparisons with = NULL and NOT IN with a subquery are reported with their line numbers.

Other useful tools