Format SQL
Reformat SQL with consistent indentation and keyword casing, keeping string literals, comments and quoted identifiers untouched.
Working…
Questions people ask
- Is my SQL sent to or run against a database?
- No, and the whole tool exists to say that plainly. The input is read as text, rearranged by the formatter, and written back. There is no connection, no dialect check and no execution, so a half-finished or even nonsensical query can still be tidied.
- What exactly is preserved down to the character?
- String literals, line comments and quoted identifiers survive verbatim. Keyword casing changes only the keywords, and only when you pick upper or lower; choosing preserve leaves them exactly as you wrote them. Your values are never recased or re-quoted.
- What happens to invalid SQL?
- It is formatted best-effort. The formatter rearranges tokens; it does not validate your SQL, so a broken statement still comes back with the same broken tokens arranged tidily, and the statement count is reported either way. If you need a grammar check, this is not that tool.
- Which dialect does the formatting follow?
- A generic one. Spacing, indentation and keyword casing are reflowed the same way for every dialect; dialect-specific syntax is treated as ordinary tokens and passed through. That is why nothing here can disagree with your dialect: it is never parsed that deeply.
- Does the output stay the same if I run it twice?
- Yes. The formatter is deterministic: the same input with the same settings produces identical bytes every run, which makes it safe to keep in checklists and diffs.
- What happens to my files?
- The upload is removed as soon as processing finishes; the formatted file stays downloadable for about 10 minutes, then it is deleted automatically.