How to format SQL in Notepad++
Notepad++ has excellent SQL syntax highlighting and no SQL formatter whatsoever. The highlighting is what misleads people: colour makes the file look like the editor understands SQL, but nothing in the base install will re-indent a query. The standard fix is a plugin, and there is exactly one that most people mean — Poor Man's T-SQL Formatter, which is free, open source, and installable from inside Notepad++ in under a minute.
Short answer
Not built in — install a plugin
Plugins → Plugins Admin, search for Poor Man's T-SQL Formatter, tick it and install. After the restart the command lives under Plugins → Poor Man's T-SQL Formatter → Format T-SQL, bound to Ctrl+K by default.
- Windows
- Ctrl+K
Step by step in Notepad++
- 01
Open Plugins Admin
Plugins → Plugins Admin opens the built-in plugin catalogue. This is the supported route and it handles the 32-bit versus 64-bit question for you, which is the usual cause of a manually dropped plugin DLL silently failing to load.
- 02
Install Poor Man's T-SQL Formatter
Search the Available list for “Poor Man's T-SQL Formatter”, tick the checkbox and click Install. Notepad++ will close and reopen itself to finish. If it does not appear in the catalogue — which happens on older Notepad++ builds — the project publishes a zip you can unpack into the plugins folder by hand.
- 03
Format a query
Select the SQL you want to reformat, or leave the cursor in the document to format all of it, then use Plugins → Poor Man's T-SQL Formatter → Format T-SQL, or press Ctrl+K. There is also a colourise-only command if you want syntax colouring for pasting elsewhere without changing the layout.
- 04
Tune the style
The plugin's own settings dialog covers indent width, maximum line width, whether comma lists expand one-per-line, trailing commas, expansion of boolean expressions and CASE statements, breaking JOIN ON sections onto their own lines, and keyword uppercasing. It also offers an obfuscate mode that strips the query to a single minified line.
- 05
Protect regions you do not want touched
The formatter honours special comment tags: wrap a block in a [noformat] comment pair and it is left exactly as written, or use [minify] to collapse a block. Useful for hand-aligned lookup tables and generated blocks that a reformat would ruin.
SQLite, before and after
The unformatted query below is the sample loaded into the editor above, and the output is exactly what this formatter returns for it with the default options. Nothing was tidied up by hand.
SELECT s.store_id, s.store_name, i.sku, i.quantity_on_hand, i.reorder_level FROM inventory AS i JOIN stores AS s ON s.store_id = i.store_id WHERE i.quantity_on_hand < i.reorder_level AND s.region = :region AND i.last_counted_at < :cutoff_date ORDER BY s.store_name, i.sku; SELECT
s.store_id,
s.store_name,
i.sku,
i.quantity_on_hand,
i.reorder_level
FROM
inventory AS i
JOIN stores AS s ON s.store_id = i.store_id
WHERE
i.quantity_on_hand < i.reorder_level
AND s.region = :region
AND i.last_counted_at < :cutoff_date
ORDER BY
s.store_name,
i.sku; What Notepad++ still won't do
None of this is a knock on Notepad++ — these are just the edges of what an in-editor formatter is for. They are also the reason there is a formatter at the top of this page.
- It is a T-SQL formatter. The name is literal — Poor Man's T-SQL Formatter targets Transact-SQL, and modern analytical dialects such as ClickHouse, BigQuery Standard SQL, Snowflake and DuckDB are outside what it parses.
- It is Windows-only, because Notepad++ is. There is no macOS or Linux path here at all.
- Plugin installation is blocked on plenty of managed machines, which is the situation that sends most people looking for a web formatter in the first place.
- Neither the plugin nor Notepad++ does anything about query parameters, and neither helps you read a WHERE clause with five levels of nested AND/OR.
Notepad++ SQL formatting FAQ
Does Notepad++ have a built-in SQL formatter?
No. Notepad++ provides SQL syntax highlighting but no formatting command of any kind. Every route to formatted SQL in Notepad++ goes through a plugin.
How do I install the SQL formatter plugin in Notepad++?
Plugins → Plugins Admin, find “Poor Man's T-SQL Formatter” in the Available tab, tick it and click Install. Notepad++ restarts itself to complete the installation.
What is the Notepad++ SQL format shortcut?
Ctrl+K, once the Poor Man's T-SQL Formatter plugin is installed. The same command is on the menu at Plugins → Poor Man's T-SQL Formatter → Format T-SQL. Notepad++ has no such shortcut without the plugin.
The plugin does not show up in Plugins Admin. What now?
That usually means an older Notepad++ build whose catalogue predates the plugin, or an architecture mismatch. Upgrade Notepad++ first; failing that, download the plugin zip from the project and unpack it into your Notepad++ plugins directory, matching 32-bit or 64-bit to your install.
Can it format BigQuery or ClickHouse SQL?
No — it parses T-SQL. For those dialects use a formatter that carries the right grammar; the one embedded above handles nineteen dialects including BigQuery, ClickHouse, Snowflake and Trino.
Is there a way to format SQL without installing a plugin?
Yes. The formatter on this page runs entirely in your browser — nothing is installed and nothing is uploaded — which is usually the fastest route on a machine where you do not control what gets installed.
Verified 2026-08-20 against