Formats

SQL Formatter

Format and beautify SQL queries.

How to use it

  1. Open Devly from the wrench in your menu bar, or press ⌃⌥⌘D. Press ⌘P, type SQL Formatter and press Return.
  2. Paste or type your text into Input.
  3. Adjust the Options on the right if you need to. The defaults are listed below.
  4. Press Format, or ⌘↵.
  5. Use Copy or ⇧⌘C to copy the result. ⌘L clears everything.

Options

OptionValuesDefault
Keyword caseCase for SQL keywordsUPPERCASE, lowercase, CapitalizeUPPERCASE
Indent SpacesNumber of spaces for indentation1–82
New line before AND/ORPlace AND/OR on new linesOn or offOn
Comma at start of linePlace commas at beginning of linesOn or offOff

Example

Real output from Devly, with the default options.

Input
select u.id, u.name, count(o.id) as orders from users u left join orders o on o.user_id = u.id where u.created_at > '2026-01-01' group by u.id, u.name order by orders desc limit 10;
SELECT u.id,
u.name,
COUNT(o.id) AS orders
FROM users u
LEFT
JOIN orders o ON o.user_id = u.id
WHERE u.created_at > '2026-01-01'
GROUP BY u.id,
u.name
ORDER BY orders DESC
LIMIT 10;

From Terminal

With the free command-line tool installed:

Terminal
devly sqlformat --path input.txt
# or pipe text in
pbpaste | devly sqlformat

Quick Switch also finds it by: sql, format, beautify, query, database, mysql, postgresql.

More Formats tools