Skip to content
All tools

SQL Formatter

Available

Format SQL into a readable layout and inspect its lexical structure without sending queries anywhere.

Runs locally. Your SQL never leaves this browser.

Local lexical formatter

The formatter tokenizes first, keeps strings, quoted identifiers and comments opaque, then changes layout only outside those tokens.

SQL input

Paste one or more statements. Press Ctrl/Cmd+Enter to format.

Formatted output

Only recognized keywords and whitespace outside protected tokens are rewritten.

Lexical inspection

Statements
0
Keywords
0
Comments
0
Parameters
0

Dialect boundary

The formatter does not analyze schemas or validate a database dialect. Vendor-specific extensions may remain in the query, but Devary does not claim they are valid or equivalent.

Readable SQL without execution

Normalize layout and keyword casing before reviews, debugging or documentation without connecting to a database.

Formatting, not semantic validation

This formatter preserves quoted content and comments, but it does not execute queries or prove that vendor-specific SQL is semantically valid.

Developer guide

Format SQL while preserving literals and inspecting statements

SQL Formatter reflows SQL tokens locally, using selected keyword casing and indentation without executing a query or checking its database semantics.

Practical workflow

  1. Configure

    Paste SQL and choose uppercase, lowercase or preserved keyword casing and 2- or 4-space indentation.

  2. Try it

    Run the formatter, then inspect statements, parameters and comments alongside the formatted output.

  3. Check the result

    Check the query against your actual SQL dialect and database. Formatting does not validate schema names or query results.

Worked examples

Format a SELECT statement

The formatter moves major clauses to separate readable lines while maintaining the original tokens.

Configuration

keywordCase=upper; indentSize=2

Example input

select id from users where active = true;

Expected result

SELECT id
FROM users
WHERE active = TRUE;

Protect quoted words

The string literal 'from' stays a string even when SQL keywords are transformed.

Configuration

keywordCase=lower; indentSize=4

Example input

select 'from' as label;

Expected result

select 'from' as label;

Limits and safeguards

Supported scope

This is lexical formatting; it does not connect to a database, execute statements or validate table schemas.

Before using in production

Dialect-specific constructs may format differently. Unterminated strings, comments or identifiers cause safe failures instead of a silent rewrite.

Common question

Does successfully formatted SQL mean my query is valid?

No. The formatter checks lexical structure, not semantic validity, execution plans or compatibility with a specific server.