⚙ GraphQL Formatter
Format, beautify, or minify GraphQL queries and mutations.
Last updated: November 8, 2026 · By the BoltQuickTools team
Make a one-line GraphQL query readable again
GraphQL queries often end up squashed onto one line in logs, network traces and string constants. This page is for developers who need to read one, or compact one for embedding. It reformats the text in the page with a small tokenizer, and the tool's code makes no network request.
Using the buttons
- Paste into Input. The Output pane updates in 2-space style with every edit.
- Press Beautify for 2 spaces, 4-Space for 4 spaces, or Minify to compact it.
- Press Copy Output. Editing the input again returns the output to 2-space style, so press Minify or 4-Space last.
Before and after
The page loads with this query:
query GetUser($id:ID!,$includeOrders:Boolean=false){user(id:$id){id name email orders @include(if:$includeOrders){id total items{name price quantity}}}}
Beautify gives:
query GetUser($id: ID!, $includeOrders: Boolean=false) {
user(id: $id) {
id name email orders @include(if: $includeOrders) {
id total items {
name price quantity
}
}
}
}
Minify gives:
query GetUser($id: ID!, $includeOrders: Boolean=false) {user(id: $id) {id name email orders @include(if: $includeOrders) {id total items {name price quantity}}}}
Line breaks follow braces and commas, so fields separated only by spaces stay together on one line. Put commas between fields if you want one per line. { a, b, c } beautifies with each field on its own line, though the commas stay in the output. Minify is not the smallest possible form either: it keeps a space after each colon and before each opening brace.
Input that does not survive
- Do not minify a query containing comments. A comment is not followed by a line break in minified output, so it swallows the rest of the document. A query with a
# topcomment came out as# topquery A {# noteid name}, which is no longer usable. Delete the comments first. - Triple-quoted descriptions are misread.
"""comes back split as"" ", which changes the text. Do not run schema files with block strings through it. - This is built for operations rather than schema definition files.
union A = B | Cbecomesunion A=B|C, and consecutive type definitions can join onto one line. - Spaces around
=are removed. Variables separated only by a space lose it:$a: Int $b: Intbecomes$a: Int$b: Int. GraphQL still parses that, but it reads badly. - An object argument is spread over several lines, because its braces count like any others.
When the output looks wrong
Does it check that my query is valid?
Only that curly braces balance. Anything else passes: qurey X ( { a } beautified with a success message, even with a misspelled keyword and an unclosed parenthesis. It never sees your schema.
Why did the output disappear?
Unbalanced braces clear the output and show Parse error: unbalanced braces in the status line, with the depth when a brace is left open. That is normal while you are halfway through typing a block. Braces inside double-quoted strings are not counted.
Where do I test the formatted query?
Send it to your endpoint with the API tester, or turn a captured request into code with curl to code. The variables object is plain JSON, which the JSON formatter handles.