Skip to content
| Marketplace
Sign in
Visual Studio Code>Programming Languages>Nifty SQL: SQL Formatter for 20 DialectsNew to Visual Studio Code? Get it now.
Nifty SQL: SQL Formatter for 20 Dialects

Nifty SQL: SQL Formatter for 20 Dialects

Nifty

| (0) | Free
Format SQL in 20 dialects, including dbt and Jinja templates, with your team's settings.
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

Nifty SQL

Format SQL in 20 dialects, including dbt and Jinja templates, with settings your whole team shares.

Maintained. No sign-in. No telemetry. Works in VS Code, Cursor, Windsurf, VSCodium and other editors that use Open VSX.

Features

A one-line PostgreSQL report query formatted with the team's .sql-formatter.json, with the dialect in the status bar

A dbt model formatted for Snowflake: ref() calls and the is_incremental() block survive

SQL inside a Python string formatted in place, keeping its indentation and the %(days)s parameter

  • 20 dialects. Standard SQL, PostgreSQL, MySQL, MariaDB, SQL Server (T-SQL), Oracle PL/SQL, SQLite, Snowflake, BigQuery, Redshift, DuckDB, ClickHouse, Spark, Hive, Trino, Db2, Db2 for i, N1QL, SingleStoreDB and TiDB.
  • Just use Format Document. Nifty SQL plugs into VS Code's built-in Format Document, Format Selection and format on save for SQL files.
  • Format SQL anywhere. Select a query inside Python, TypeScript, Go or any other file and run Nifty SQL: Format SQL. The result keeps the indentation of the surrounding code, and query parameters such as %(name)s, ${id} and :name stay as they are.
  • dbt and Jinja friendly. {{ ref('orders') }}, {% if is_incremental() %} and {# comments #} survive formatting untouched, and block tags stay on their own lines.
  • One style for the whole team. Commit a .sql-formatter.json to your repo and everyone gets the same output. It is the same file the sql-formatter CLI reads, so CI can check formatting too. You get autocomplete and validation while editing it.
  • The right dialect automatically. The dialect comes from the file's language (e.g. files marked MySQL or PostgreSQL by your database extension), and is shown in the status bar (a language in .sql-formatter.json wins). Click it to set a dialect for the workspace.
  • Errors you can read. If the SQL can't be parsed you get one line saying where, not a wall of text.
  • Works in the browser on vscode.dev and github.dev.

Commands

Command What it does
Nifty SQL: Format SQL (Document or Selection) Format the selection, or the whole file if nothing is selected. Works in any language.
Nifty SQL: Format SQL with Dialect… Pick a dialect for a one-off format
Nifty SQL: Set SQL Dialect for Workspace… Save the dialect for this workspace (also available by clicking the status bar)

Nifty SQL is the default formatter for .sql files. To format on save, add this to your settings:

"[sql]": {
  "editor.formatOnSave": true
}

Team configuration: .sql-formatter.json

{
  "language": "postgresql",
  "keywordCase": "upper",
  "tabWidth": 4,
  "linesBetweenQueries": 2
}

Nifty SQL uses the nearest .sql-formatter.json above the file (within the workspace). Its values override your personal settings.

Settings

Setting Default What it does
nifty.sql.dialect auto Dialect, or auto to use the file's language
nifty.sql.keywordCase preserve preserve, upper or lower for keywords
nifty.sql.dataTypeCase preserve Case for data types
nifty.sql.functionCase preserve Case for function names
nifty.sql.identifierCase preserve Case for table and column names
nifty.sql.indentStyle standard standard, tabularLeft or tabularRight
nifty.sql.logicalOperatorNewline before Line break before or after AND / OR
nifty.sql.expressionWidth 50 Width at which parenthesised expressions are split
nifty.sql.linesBetweenQueries 1 Empty lines between statements
nifty.sql.denseOperators false a+b instead of a + b
nifty.sql.newlineBeforeSemicolon false Put the closing ; on its own line
nifty.sql.templating auto Jinja/dbt handling: auto, jinja or none
nifty.sql.useConfigFile true Read .sql-formatter.json
nifty.sql.showDialectInStatusBar true Show the dialect in the status bar

Indentation (spaces or tabs, and width) follows your editor settings unless .sql-formatter.json sets it.

Install

  • VS Code: search for "Nifty SQL" in the Extensions view, or install from the Visual Studio Marketplace.
  • Cursor, Windsurf, VSCodium, Kiro, Antigravity: install from Open VSX.

Credits

Formatting is powered by the excellent open-source sql-formatter library (MIT).

Privacy

This extension collects no telemetry, needs no account and makes no network requests.

More Nifty tools

  • Nifty Beautify: Format HTML in PHP, Blade & Twig: Format HTML inside PHP, Blade, Twig, Jinja, Handlebars, ERB and Liquid templates without breaking the template tags. (Open VSX)
  • Nifty YAML: Formatter, Validator & Converter: Format YAML without losing comments (Kubernetes-style indents), sort keys, lint with yamllint, copy the key path, and convert to and from JSON. (Open VSX)
  • Nifty JSON: Formatter, Validator & JSONPath: Format, minify, sort keys, query with JSONPath, copy paths, generate TypeScript types, and browse huge JSON files in a fast tree view. (Open VSX)
  • Nifty XML: XPath, Formatter & XML to JSON: Evaluate XPath with namespaces, copy the XPath of any element, format, minify, check well-formedness and convert XML to JSON. (Open VSX)
  • Nifty Data Viewer: CSV & Parquet Viewer with SQL: Open CSV, Parquet and JSON files as a fast table and query them with SQL, powered by DuckDB. Sort, page through millions of rows, and export to CSV, Parquet or JSON. (Open VSX)
  • Nifty SQLite: SQLite Viewer & Query Editor: Browse and query SQLite databases: tables and views in the side bar, a fast grid for any table, SQL queries with results, and export to CSV or JSON, with no native modules. (Open VSX)

See all 18 Nifty tools at https://getnifty.dev

  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
  • Your Privacy Choices
  • Consumer Health Privacy
© 2026 Microsoft