GraphQL Query Formatter
Pretty-print and indent GraphQL queries.
How to use
- 1 Paste your GraphQL query or mutation into the input box.
- 2 Pick two- or four-space indentation.
- 3 Review the formatted query on the right.
- 4 Copy the tidied query to your clipboard.
About GraphQL Query Formatter
The GraphQL Query Formatter cleans up cramped, single-line or inconsistently indented GraphQL into a neatly structured, readable shape.
Whether you copied a query out of a network log, a code string or a colleague's message, this tool re-indents it so every selection set, field and nested object lines up the way you would write it by hand.
It works by walking the structure of your query: each opening brace increases the indentation level, each field in a selection set is placed on its own line, and closing braces dedent cleanly.
Arguments inside parentheses are kept together on the field line, so "user(id: 5)" stays intact rather than being scattered across rows.
String literals — including block strings wrapped in triple quotes — are preserved exactly, so braces or hashes inside a string are never mistaken for structure or comments.
Comment lines beginning with "#" are kept on their own line at the correct depth.
Choose two- or four-space indentation, then copy the formatted result.
If the braces are unbalanced or a string is left unterminated, you get a precise error rather than mangled output.
Everything is processed locally in your browser, so your queries — and any embedded identifiers or sample data — never leave your machine, and the formatter keeps working offline.
FAQ
Does it validate my GraphQL schema?
No. It is a structural formatter that re-indents based on braces and parentheses; it checks for balanced braces and closed strings but does not validate against a schema.
Are arguments and strings preserved?
Yes. Arguments stay on the field line and string literals — including triple-quoted block strings — are kept exactly as written.