How This GraphQL Formatter Works
Paste a GraphQL query, mutation, subscription, or schema definition and pick a mode. Format mode, this graphql pretty print tool that doubles as a way to beautify graphql on demand, reindents the whole thing using consistent bracket-depth indentation at whatever size you set (1 to 8 spaces), stripping # comments along the way while staying aware of string literals and """ block strings, so punctuation inside a string is never mistaken for structural syntax. Minify mode, acting as a graphql minifier, strips comments and collapses all whitespace down to the minimum needed to stay valid, reporting exactly how much smaller the output is as a percentage. Validate mode checks bracket balance and string closure without reformatting anything, useful as a graphql syntax checker before you paste a query into a formatter or minifier at all.
What the Validator Actually Checks
It's worth being precise about what this graphql query validator does and doesn't catch. It's a graphql bracket validator, specifically: it tracks every {, (, and [ against its matching closer, flags an unexpected closer with no matching opener, flags brackets left open at the end of input, and flags an unclosed string literal. It does not know GraphQL's actual grammar, it won't catch a field that doesn't exist on a type, an argument of the wrong type, a missing required argument, or a fragment referencing an undefined type, those require a real GraphQL parser with schema awareness, which this tool intentionally isn't. Think of it as a fast first pass that catches the most common copy-paste mistake, mismatched or missing brackets, not a substitute for running the query against a real schema.
Formatting vs Minifying GraphQL
Format graphql query output is for humans, reviewing a query in a pull request, debugging why a query isn't matching expectations, or just making a copy-pasted blob of GraphQL readable again. Minify graphql query output is for machines, shaving payload size when a query string gets embedded directly in a request body or bundled into client-side code, every stripped comment and collapsed whitespace character is one less byte sent over the wire. The minify mode reports the size savings directly, so it's easy to see whether minifying a particular query is actually worth the reduced readability for a given use case.
Common Uses
Cleaning up a minified query pasted from a browser network tab into something reviewable, validating a hand-written query for balanced brackets before sending it in a request, minifying a query to shave payload size in a mobile or low-bandwidth client, and standardizing indent width across a team's .graphql files are the most common uses of this graphql formatter online tool. Using validate mode as a graphql schema formatter's quick pre-check, confirming a schema definition's brackets are balanced before formatting or committing it, is a common secondary use.
What This Tool Doesn't Do
This is a syntactic formatter, not a real GraphQL parser, there's no AST and no schema awareness behind it. It doesn't validate that referenced types, fields, or fragments actually exist, doesn't check argument types or required-argument presence, and doesn't execute the query or connect to any GraphQL endpoint, this is a pure text transformation tool with no network calls of its own. It also doesn't claim to match the exact formatting conventions of any specific style guide or the official GraphQL reference formatter beyond consistent bracket-depth indentation, if a team has a stricter house style (trailing commas, specific field ordering), this tool won't enforce it.