GraphQL Formatter
Works on queries, mutations, fragments and SDL. Block strings and comments are preserved when pretty-printing and dropped when minifying.
GraphQL Formatter — Free Online Tool
Formats and minifies GraphQL queries, mutations and SDL schemas with a purpose-built tokenizer that understands block strings, string escapes, comments, directives and variable definitions, normalizing indentation and argument spacing, and reporting unbalanced braces or parentheses with the line where the imbalance starts.
How to use the GraphQL Formatter
- Open the tool above — it runs entirely in your browser, so your input never leaves this page.
- Paste or type your input into the field, then press the relevant button (e.g. Encode / Decode, Generate, or Convert).
- Copy the result from the output area with the copy button orCtrl/Cmd + C.
- No signup, no upload, and no tracking — repeat as often as you need.
Frequently asked questions
Does it validate my query against a schema?
No. It checks that the document tokenizes and that braces balance, reporting where an imbalance starts. Validating field names and argument types requires the schema, which a formatter does not have.
Are block strings and comments preserved?
Block strings ("""…""") keep their internal line breaks exactly, and # comments stay on their own line when pretty-printing. Minifying drops comments, since removing them is the point.
Why not just use a regex to indent braces?
Because a brace inside a block string or a comment is not structure. A regex-based formatter mangles a description containing { }, which is why this uses a tokenizer that knows about strings and comments.
Free & private — why use this GraphQL Formatter
The GraphQL Formatter runs 100% client-side in your browser. Your data is never uploaded to a server, no account is required, and the tool is completely free. It works offline once the page has loaded and is part of a growing collection of privacy-first developer utilities.