Format SQL on Linux — Free Browser Tool, Any Distribution
Table of Contents
Linux SQL formatting options break down into command-line tools (sqlfluff, pgFormatter, poor-man's-t-sql-formatter via mono) and full database GUIs (DBeaver, DataGrip, pgAdmin). Both categories require an install. For Ubuntu users, that means apt-get; for Fedora, dnf; for Arch, pacman; for Debian, more apt-get. None of this is hard if you have admin rights, but it is friction for an occasional formatting task.
Our formatter runs in any Linux browser. Firefox is pre-installed on Ubuntu, Fedora, and most other distros. Chrome works on every major distro. The formatter is a webpage with no native dependencies — no apt, no yum, no snap, no flatpak. Works the same on Ubuntu 22.04, Fedora 39, Arch, Debian, Mint, Pop!_OS, openSUSE, and any other distribution.
Linux SQL Formatting Options — CLI vs GUI vs Browser
Command-line tools:
- sqlfluff — Python-based, install via pip. Excellent for CI pipelines. Overkill for one-off formatting.
- pgFormatter — Perl-based, Postgres-specific. Best Postgres formatter available.
- sql-formatter-cli — Node.js-based, install via npm. Same library as our browser tool.
- poor-man's-t-sql-formatter — runs under mono, awkward on modern Linux.
GUI tools:
- DBeaver Community — free, requires Java, available as snap/flatpak/AppImage.
- DataGrip — JetBrains, $229/year, Linux-native.
- Beekeeper Studio — free Community edition, paid Ultimate. Lightweight Electron app.
- pgAdmin — Postgres only, web-based or native.
- MySQL Workbench — MySQL only, RPM/DEB packages.
Each of these is a real install. The browser tool is just a URL.
Why CLI Installs Are Overkill for Occasional Formatting
If you write SQL all day in a CI/CD pipeline, sqlfluff or pgFormatter via the command line is the right tool. They integrate with git pre-commit hooks, run in CI, and enforce formatting consistency across teams.
For everyone else — the developer who writes SQL once a week, the SRE debugging a slow query during an incident, the data analyst using SQL in dashboards — CLI tools are overkill. The friction:
- Install step — pip install sqlfluff or apt install postgresql-pgformatter, plus dependencies.
- Configuration — sqlfluff needs a .sqlfluff config file or it makes opinionated choices you may not want.
- Dialect flags — sqlfluff --dialect postgres input.sql is more verbose than picking from a dropdown.
- Pipe ergonomics — pasting SQL into a shell heredoc is awkward; saving to a file and running the formatter is even more awkward.
- Output to terminal vs file — re-piping the output is friction.
The browser tool fits the occasional-use case better: paste, click, copy, done.
How to Format SQL on Linux in Your Browser
- Open the formatter URL in your Linux browser — Firefox (default on Ubuntu, Fedora), Chrome, or Chromium.
- Bookmark the page — Ctrl+D to save.
- Copy your SQL from anywhere — psql, mysql, sqlite3 command-line clients, DBeaver, DataGrip, your editor, a terminal output, anywhere.
- Paste into the formatter input — Ctrl+V or middle-click paste.
- Pick your dialect — Standard, MySQL, PostgreSQL, SQLite, MariaDB, BigQuery, or Transact-SQL.
- Click Format — output appears with syntax highlighting.
- Click Copy — formatted SQL is on your clipboard.
- Paste back into your destination.
For frequent users on tiling window managers (i3, sway, awesome), pin the browser tab in a workspace dedicated to development tools.
Sell Custom Apparel — We Handle Printing & Free ShippingLinux Distribution Support
The formatter works the same on every distribution because it runs in your browser. The list of supported distros is essentially "any Linux that can run a modern browser":
- Ubuntu — 18.04 LTS and later.
- Fedora — 30 and later.
- Debian — 10 (Buster) and later.
- Arch Linux — rolling release, always supported.
- Linux Mint — 19 and later.
- Pop!_OS — 20.04 and later.
- openSUSE — Leap and Tumbleweed.
- Manjaro — rolling release.
- Elementary OS — 5 and later.
- Kali Linux — for security researchers who need to format SQL queries from injection testing.
- Alpine Linux — works in Firefox or Chromium.
- NixOS — works in any browser available in nixpkgs.
- Raspberry Pi OS — works in Chromium on Raspberry Pi.
If your distro can run Firefox or Chromium, the formatter works.
When to Use the CLI Instead — sql-formatter-cli
If you find yourself formatting SQL many times per day from the terminal, install sql-formatter-cli (the same library that powers our browser tool):
npm install -g sql-formatter
Then format from the command line:
echo "select * from users" | sql-formatter -l postgresql
Or format a file:
sql-formatter -l postgresql input.sql > output.sql
The CLI version produces identical output to the browser tool because they share the same library. Use the browser for one-off formatting, install the CLI for batch processing or CI integration.
For Postgres-specific work, pgFormatter is also worth installing — it understands more Postgres-specific patterns than the generic sql-formatter library.
Other Browser Tools for Linux Developers
If you like browser-based developer tools, these others work the same way:
JSON formatter — formatting JSON without piping to jq. JSON Formatter.
Code diff checker — comparing two pieces of code without diff or vimdiff. Code Diff Tool.
Regex tester — testing regex without grep -P trial-and-error. Regex Tester.
Cron expression generator — building crontab schedules visually. Cron Generator.
Try It Free — No Signup Required
Runs 100% in your browser. No data is collected, stored, or sent anywhere.
Open Free SQL FormatterFrequently Asked Questions
Does this work on Ubuntu, Fedora, Arch, and other distros?
Yes. The formatter is a website that runs in any modern browser. Firefox (default on Ubuntu, Fedora) works. Chrome works on every major distribution. Distribution does not matter because nothing is installed natively.
Can I use this on a Linux server with no GUI?
No — this is a browser-based tool. For headless servers, install sql-formatter-cli via npm and run it from the command line. The output will be identical because both use the same underlying library.
How does this compare to sqlfluff and pgFormatter?
sqlfluff is best for CI pipelines and team-wide enforcement. pgFormatter is the best Postgres-specific formatter. The browser tool is best for one-off formatting where install friction would be excessive. Most developers use both — CLI for automation, browser for ad-hoc.
Does it work on Wayland-based desktops like GNOME on Ubuntu 22.04?
Yes. The browser handles Wayland natively. Firefox and Chrome both work on Wayland with no special configuration.
Can I run it on a Raspberry Pi?
Yes. Chromium on Raspberry Pi OS handles the formatter without issues. Performance is acceptable for queries up to several hundred lines.

