gitwtfhub

wtf is sql-formatter?

beekeeper-studio/sql-formatter — explained in plain English

Analysis updated 2026-08-07 · repo last pushed 2026-03-27

TypeScriptAudience · developerComplexity · 2/5MaintainedLicenseSetup · easy

TL;DR

A tool that cleans up messy SQL database queries with consistent spacing, line breaks, and indentation. It supports many database systems, fills in placeholders, runs as a command-line tool, and plugs into code editors.

Mindmap

mindmap
  root((repo))
    What it does
      Cleans up SQL
      Adds indentation
      Fills placeholders
    How you use it
      In your code
      Command line tool
      VSCode editor
    Supported databases
      MySQL
      Snowflake
      BigQuery
    Use cases
      Format on save
      Readable queries
      Team style rules
    Status
      Maintenance mode
      Bug fixes only

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

Why would anyone build with this?

REASON 1

Format SQL queries automatically inside VSCode every time you save a file.

REASON 2

Paste a tangled SQL query into the online demo to make it readable before sharing.

REASON 3

Enforce consistent SQL style rules across a team using an ESLint plugin.

REASON 4

Format SQL files in bulk from the command line.

What's in the stack?

TypeScriptNode.jsCLIESLint

How it stacks up

beekeeper-studio/sql-formatter0xdevalias/sparkle0xdevalias/webcrack
LanguageTypeScriptTypeScriptTypeScript
Last pushed2026-03-272022-06-292026-06-03
MaintenanceMaintainedDormantMaintained
Setup difficultyeasymoderatemoderate
Complexity2/54/52/5
Audiencedeveloperdeveloperdeveloper

Figures from each repo's GitHub metadata at analysis time.

How do you spin it up?

Difficulty · easy Time to first run · 5min

Install via npm and call it on a SQL string or run the CLI, no external dependencies required.

Use freely for any purpose, including commercial use, as long as you keep the copyright notice.

Wtf does this do

SQL Formatter is a tool that takes messy, hard-to-read SQL database queries and cleans them up with consistent spacing, line breaks, and indentation. If you've ever inherited a wall of unformatted database code, this tool turns it into something a human can actually scan and understand. At a high level, you give it a raw SQL string and it returns a neatly organized version. You can tell it which specific database system you're using, since databases like MySQL, Snowflake, and BigQuery have slightly different rules. It can also fill in placeholder values, so a query with a "?" in it can be turned into a complete, readable statement. Beyond being used directly in code, it works as a command-line tool to format files, and it plugs into popular code editors like VSCode. This is useful for anyone who writes or reviews database queries. For example, a developer building an app can use it inside their editor to automatically format SQL every time they save a file, keeping the team's code consistent. A product manager analyzing data might paste a long, tangled query into the tool's online demo to make it readable before showing it to colleagues. It can even enforce style rules in a team's workflow through an ESLint plugin. One notable thing is that the project is currently in maintenance mode. The creator is only fixing bugs here, not adding new features, because they are focusing on a newer tool that uses a smarter underlying engine to handle complex queries better. However, this version remains widely supported. It does have some limitations: it cannot format stored procedures, and it occasionally chokes on templated code, though the README provides a workaround using custom configuration options.

Yoink these prompts

Prompt 1
Install sql-formatter in my Node project and use it to format a MySQL query string with proper indentation. Show me the code.
Prompt 2
Set up sql-formatter as a command-line tool to format all .sql files in my project folder. What command do I run?
Prompt 3
Configure sql-formatter to format a BigQuery query that uses question-mark placeholders, filling them in with actual values. Show an example.
Prompt 4
Add sql-formatter to my ESLint setup so my team's SQL queries follow consistent style rules. Walk me through the config.

Frequently asked questions

wtf is sql-formatter?

A tool that cleans up messy SQL database queries with consistent spacing, line breaks, and indentation. It supports many database systems, fills in placeholders, runs as a command-line tool, and plugs into code editors.

What language is sql-formatter written in?

Mainly TypeScript. The stack also includes TypeScript, Node.js, CLI.

Is sql-formatter actively maintained?

Maintained — commit in last 6 months (last push 2026-03-27).

What license does sql-formatter use?

Use freely for any purpose, including commercial use, as long as you keep the copyright notice.

How hard is sql-formatter to set up?

Setup difficulty is rated easy, with roughly 5min to a first successful run.

Who is sql-formatter for?

Mainly developer.

View the repo → Decode another repo

This repo across BitVibe Labs

Don't trust strangers blindly. Verify against the repo.