GraphQL Formatter
Parse, format, or minify GraphQL operations and summarize variables and fragments
Uses the reference GraphQL parser for document syntax. Accepts operations and SDL, up to 2 MiB and 50,000 tokens. No schema, field/type checks, or authorization checks.
The syntax-valid GraphQL document will appear here.
About this tool
GraphQL Formatter uses the reference GraphQL parser and printer for syntax parsing, readable formatting and minification. It accepts executable operations, fragments and schema definition language (SDL). The summary counts operations, variable definitions across operations, fragments and all definitions; SDL contributes to the last count. Formatting discards source comments, while descriptions and string values remain part of the parsed document. Minification removes ignored commas, whitespace and comments while preserving token boundaries. Inputs are limited to 2 MiB and 50,000 tokens. A syntax-valid result can still contain unknown fields, duplicate operation names or incompatible fragments: no schema validation or request execution takes place. Input or mode changes clear the previous output; pending parser loading cannot restore a cleared result.
Scenario Recipes
Normalize a captured GraphQL operation for code review
Goal: Separate document syntax cleanup from schema and runtime debugging
- Paste the complete operation with all fragment definitions and format it.
- Review operation names, variable count, fragments, and any syntax location errors.
- Commit the normalized document, then validate it separately against the current schema and execute it in an authorized environment.
Result: A readable syntax-valid operation with schema and runtime checks kept explicit.
Frequently Asked Questions
Does it support mutations and subscriptions?
Yes. The reference parser accepts query, mutation, subscription, fragment, and directive syntax.
What does Minify remove?
It removes ignored whitespace, optional commas, and comments while preserving required token separation.
Will formatting preserve comments?
No. The GraphQL AST printer emits the semantic document and does not retain source comments.
Can it validate fields against my schema?
No. Without a schema it checks document syntax only, not field existence, arguments, or fragment type conditions.
Does it execute the GraphQL request?
No. It never contacts an endpoint, sends variables, or evaluates authorization.
Is the query uploaded?
No. Parsing, printing, minification, and summaries run locally.
Does it support SDL and what do the counts mean?
Yes. SDL definitions are parsed and printed, and contribute to Definitions. Operations and Fragments count executable definitions; Variable definitions sums declarations across operations, including repeated names in different operations. No schema is built or validated.
What input limits apply?
The local parser accepts up to 2 MiB of UTF-8 input and 50,000 tokens. Deeply nested or complex documents can still exceed browser parser resources and report an error.
Keep browsing