Back to Utils

Notepad++ plugin

SQL Formatter

Format SQL directly from Notepad++ with one keyboard shortcut, on a selection or the whole document.

Goal

Writing SQL is fast, but keeping it tidy takes time. The SQL Formatter plugin adds a format button to Notepad++ that automatically indents and structures your SQL. Whether you want to tidy up a single query or clean up an entire script at once: one keyboard shortcut does the job.

The plugin is written in C# and acts as a bridge to a Python-based formatter. The DLL and the formatter executable work together in the Notepad++ plugin folder.

What to expect

Selection-aware

Is text selected? Only that selection is formatted. No selection? The entire document is processed. This way you can clean up a single subquery without touching the rest of the file.

Shortcut Ctrl+Alt+F

The formatter is directly available via the Notepad++ plugin menu and via the keyboard shortcut Ctrl+Alt+F. Formatting no longer requires mouse clicks.

UTF-8 output

The output is always UTF-8 encoded, so special characters and international column names are preserved correctly.

Usage

1. Installation

Copy the plugin DLL and sql_formatter.exe to the Notepad++ plugin folder. The two files must be in the same folder:

C:\Program Files\Notepad++\plugins\
  SqlFormatter\
    SqlFormatter.dll
    sql_formatter.exe

2. Activate plugin

Restart Notepad++. The plugin appears automatically under Plugins → SQL Formatter.

3. Format SQL

Open a SQL file or paste a query into a new tab. Press Ctrl+Alt+F or go via the menu:

Plugins → SQL Formatter → Format SQL