Neatbo.

SQL formatter

Reformat PostgreSQL-style SQL with line breaks, spacing and optional uppercase keywords.

Browser-local processingInputPostgreSQL-style SQLOutputFormatted SQL textUp to 10 MiB per file · File limit: 1
  1. 1Add input
  2. 2Adjust settings
  3. 3Get your result

Tool input and files are processed in this browser without being uploaded.

Your input

or drag and drop it here

Files stay on this device. Your originals stay unchanged.

.sql · .txt

Up to 10 MiB per file · File limit: 1

    0 characters · 0 bytes
    Options

    Complete the required options first. You can keep the defaults for the rest.

    Inputs are kept temporarily in this tab when switching tools. Refreshing or closing clears them; large results may need to be regenerated.⌘ / Ctrl + Enter to run

    Preparing the tool…

    Before you start

    Make PostgreSQL-style query text easier to read. You can uppercase the keywords this tool recognizes or leave their case as typed. Formatting happens in your browser without connecting to a database or running the SQL.

    How to use this tool

    1. Paste a query into “SQL input” or choose one local UTF-8 file. Clear the text box to use the file, or remove the file to use pasted SQL alone.
    2. Under “Options”, choose whether to enable “Uppercase recognized keywords”, then select “Format SQL”.
    3. Compare the result with the original, especially numbers and operators. Use “Copy result” to copy the text or “Download” to save formatted.sql. Run the formatter again after changing the input or option.

    Supported inputs and limits

    Paste up to 1 MiB of UTF-8 text or choose one UTF-8 .sql or .txt file up to 10 MiB. Filenames can contain up to 512 UTF-16 code units; a visible character may use more than one code unit. Nonempty pasted text takes priority, including text that contains only spaces, but a selected file is still checked and read. Block comments can nest up to 100 levels.

    Worked example

    Example input

    select 'a  b', 1.25 from t where x=2;
    Example options
    {}

    Example output

    SELECT 'a  b',
      1.25
    FROM t
    WHERE x = 2;

    When something does not work

    Check quotes, comments and matching parentheses or brackets if formatting fails. For a file error, save a UTF-8 copy in another application and select it again, or remove the file and paste the SQL. Reduce oversized input or shorten a long filename. Use another formatter for unsupported syntax. After changing the input or cancelling a run, select “Format SQL” to try again.

    Frequently asked questions

    Are my files uploaded?

    No. Your SQL and files are processed in your browser. A recent workspace may remain in memory when you visit other tools in the same tab, subject to size and time limits. Refreshing or closing the tab clears it. Download any result you want to keep.

    Does this check all PostgreSQL syntax?

    No. It can reject unclosed quotes or comments and mismatched brackets, but a successful result does not prove the SQL is valid. It does not check tables, columns or query behavior. It can format array slices such as a[1:2] and preserve recognized numeric spellings such as 1_000 or 0xFF. The content of recognized dollar-quoted bodies stays unchanged.

    Documentation & further reading

    Related tools