The quick answer
Paste any GraphQL query or schema block and the formatter re-indents it live: whitespace collapses, then every selection set lands on its own line at 2-space depth. The built-in example turns 70 characters of one-line query into 9 readable lines, and a size stat shows chars in → out. Runs in your browser; schemas never upload.
What the GraphQL Formatter does
The GraphQL Formatter takes a query, mutation, fragment or SDL schema block, usually pasted as one unreadable line, and re-serializes it in a conventional layout: one selection set per line, indentation at 2 spaces per brace depth, arguments kept with their fields. Everything runs as JavaScript in your browser tab, so nothing is uploaded and no account is needed; there is no server to intercept because there is no network request at all.
Day to day it is one paste. Drop a query into the input (the box opens pre-filled with a sample) and the formatted version appears instantly, plus a size readout of chars in → out. Edit the input and the output re-renders on the next keystroke. Close the tab and both sides are gone.
How to use the GraphQL Formatter, step by step
Here is the complete workflow for the graphql formatter, from empty input to a result you can copy and trust. Only the first two steps are required.
Paste or type your GraphQL
Paste a query, mutation, fragment or SDL block, or start from the built-in example the input opens with. The tool is live: the formatted output re-renders on every keystroke.
Watch the size stat
The output panel reports chars in → out beside the result, so you can see exactly how much whitespace the reformat added or removed at a glance. Formatting usually adds characters, so a negative "saved" percentage is normal.
Review the output panel
The result panel updates live and shows the re-indented text itself; the size stat confirms the operation ran rather than silently doing nothing.
Copy the result
The Copy button puts the formatted output on your clipboard, ready for a review comment, a test fixture or documentation.
Verify with the worked example
The methodology section below shows exactly what the tool computes, with a real worked example. The fastest way to confirm your understanding matches the tool's behavior.
Leave nothing behind when done
There is no history, no server copy and no residue: input and output live only in the page, and closing the tab erases both.
What the formatter actually does to your query
The algorithm is deliberately simple and inspectable: first all whitespace collapses to single spaces, then the text is walked character by character tracking brace depth, and each selection set is emitted on its own line indented by 2 spaces per level. Arguments stay attached to their fields (user(id: 1) never splits), and each closing brace lands on its own line at the depth of the set it closes. Because it is depth-based re-serialization, it is deterministic: the same input always produces the same output.
Watch it on the built-in example: query { user(id: 1) { name email posts { title comments { body } } } }, 70 characters on one line, becomes 9 indented lines, with posts and comments nested visibly and body deepest at 4 levels. Paste that input yourself and compare; the output above is the formatter's real behavior, not a hand-drawn illustration.
Examples you can reproduce yourself
The example below is genuine formatter output for the built-in sample; paste the input yourself and diff the two. Read the shape: each selection set sits on its own line, indent grows by 2 spaces per brace level, and arguments stay attached to their fields.
Input
query { user(id: 1) { name email posts { title comments { body } } } }Output
query
user(id: 1)
name email posts
title comments
body
}
}
}
}Who formats GraphQL by hand (and why they stop)
These are the people who arrive with a flattened query and leave with a readable one.
Backend developers: queries lifted from client code or the network tab arrive as single lines inside string literals. Paste, format, and the selection set becomes reviewable at a glance, with the payload never leaving the machine.
API designers: SDL type definitions grow long and ragged as the schema evolves. Running a type block through the formatter keeps every field on its own line at consistent 2-space depth, which makes a missing field or a duplicated type jump out during schema review.
QA engineers: snapshot tests and test fixtures read better when the embedded query is formatted before it is committed, so diffs show semantic changes instead of whitespace churn.
Frontend developers: Relay and Apollo codegen files and persisted-query manifests embed queries as flat strings. Formatting one before asking a teammate to read it is the difference between a five-minute review and a squinting session.
What the page promises
The table summarizes what the graphql formatter promises and how it behaves; the same commitments every tool on this site keeps.
| Aspect | This tool |
|---|---|
| Processing | 100% client-side (JavaScript in your browser) |
| Signup required | No; no account, no email, no cookies for consent-free use |
| Data uploaded | Never; inputs stay on your device by architecture |
| Speed | Instant, live recomputation on every keystroke |
| Mobile support | Full; responsive layout that works on touch |
| Offline use | Works after first load (except live-data tools, which say so) |
| Cost | Free, funded by clearly-labelled advertising away from controls |
| Documentation | Full methodology, worked examples and FAQ on this page |
Honest limits and edge cases
The documented boundaries, stated first rather than buried:
- It reformats, it does not validate: brace-depth re-serialization cannot catch missing fields or wrong types. A GraphQL linter or the server does that.
- Braces inside string literals count as structure: the depth tracker is character-based, so a quoted block containing { } will misindent. Move such literals out or fix the indent by hand.
- Comments survive as text but not as separate lines: whitespace collapse runs first, so a leading # comment merges into the following line. Keep comments outside the pasted block when their placement matters.
Your schemas never leave the browser
Nothing transmits, by architecture rather than by promise. The re-indenting is a pure function running on your device, so the customer queries, the configs and the logs with tokens that you paste never leave it. The formatter is plain JavaScript bundled with the page: there is no processing library to fetch and no network request at any point.
Why not just use something else?
You have options for graphql formatter work. Here is how the mainstream alternatives stack up, including where they legitimately win.
| Alternative | Why people pick GraphQL Formatter instead |
|---|---|
| Prettier with the GraphQL plugin | Zero install and zero config for one-off pastes; Prettier earns its setup on a whole repo, not on one query in a browser tab |
| IDE plugins | Works in any browser on any machine, including the locked-down laptop in the meeting room |
| Re-indenting by hand | One paste instead of ten minutes of tab-counting, and the deterministic layout is identical every time |
Getting readable queries without a build step
When something behaves unexpectedly, the causes are almost always one of these:
- The output looks misindented: check for an unmatched brace or a string literal containing { } somewhere above the wrong line. The depth counter is character-based.
- A comment vanished from its own line: whitespace collapse merges # comments into the following line. Keep comments outside the pasted query.
- The size stat shows a negative "saved" percentage: expected when formatting a single-line input into a readable multi-line one, because the formatter adds newlines and indentation. The built-in 70-char example re-emits as 94 characters, which reads as -34% saved.
Frequently asked questions
How big an input can this tool handle?
The formatter is a single character-by-character walk over plain text, so the limit you eventually hit is your browser's memory, not a server quota, because there is no server. Pasted queries and SDL schemas of the size real projects produce re-indent in the same instant as small ones. That is the whole capacity model behind GraphQL Formatter.
Is the output always the same for the same input?
Yes; the formatter is a deterministic re-serialization: collapse whitespace, then emit one selection set per line at 2-space brace depth. No randomness, no heuristics, no rounding. The worked example above can be re-derived by hand in a minute, which is the point of showing it.
Is the GraphQL Formatter free to use?
Yes, and free means free: GraphQL Formatter has no signup, no email gate and no usage meter. It runs entirely in your browser, so each extra use costs this site nothing and costs you nothing either. The only limit is the one your browser itself imposes.
Does the formatter validate my GraphQL?
No; it reformats, it does not parse against the GraphQL grammar. A query with a missing closing brace still re-indents (depth simply ends where the text ends); catching semantic errors is the job of a GraphQL linter or your server. The formatting itself is deterministic, so it never silently changes your field names or arguments.
Are the queries I paste uploaded anywhere?
No. Your browser does the re-indenting in JavaScript; nothing is transmitted to any server. After loading you can cut the network entirely and GraphQL Formatter still works.
Can I use the GraphQL Formatter offline?
The graphql formatter engine is bundled with the page, so a cached copy of GraphQL Formatter keeps working without a connection. This tool has no live-data features; the network is never involved.
What kinds of GraphQL text can I paste?
Anything brace-delimited: queries, mutations, subscriptions, fragments and SDL type definitions all re-indent by the same depth rule, one selection set per line and 2 spaces per level. String literals containing braces are the one input to be careful with, since the depth counter treats them as structure.
Will formatting change my query's behavior?
No. Whitespace and indentation are insignificant in GraphQL syntax, so the formatted document is semantically identical to the input: the same operation, same arguments, same selection sets. Only layout changes, with whitespace collapsed and structure re-added at 2-space depth. Field names, arguments and literals pass through untouched.
Does the GraphQL Formatter work on mobile?
Yes; open the page on iOS or Android and GraphQL Formatter behaves the same: responsive layout, touch-sized inputs, live results. The tool is a web page, so there is nothing to install and nothing to update.
Tools that pair well with GraphQL work
These tools share the GraphQL Formatter's workflow most often; the internal links exist because people genuinely chain them, not for keyword decoration.
- JSON Formatter & Validator: the JSON payload on the other side of a GraphQL response, indented and checked in the same browser tab.
- CSS Minifier & Beautifier: the companion step when a query's styled output needs the same readable treatment.
- JavaScript Minifier: the reverse direction for the client code that embeds the query as a flat string.
Sources and further reading
The GraphQL specification defines the syntax this page reformats (insignificant whitespace included, which is exactly why formatting is behavior-safe), and Prettier is the heavyweight alternative for teams that want a formatter wired into a build. For one-off pastes, the browser does the job with zero install.
Sources and further reading
- GraphQL specification: June 2018 edition(spec.graphql.org)
- GraphQL: queries and mutations overview(graphql.org)
- Prettier: opinionated code formatter (GraphQL plugin)(prettier.io)
We cite primary sources (standards bodies, government agencies, official documentation) wherever they exist so you can verify every number on this page yourself.