Code & files / GraphQL
GraphQL Formatter: Pretty-Print or Minify Queries
Format GraphQL in your browser: paste a query, mutation, subscription, fragment, or schema and get one field per line with consistent indentation, inline arguments, variables, lists, and input objects, and comments kept, or minify it to the shortest equivalent text.
GraphQL Formatter: Pretty-Print or Minify Queries: The document is split into GraphQL tokens, names, strings, block strings, numbers, punctuation, and comments, then laid out: each selection set opens a new indented block, fields go one per line, and arguments stay inline with commas, as in user(id: $id) or orderBy: { field: NAME }. Minifying drops comments and every space that is not needed between two names. Runs 100% locally in your browser with zero server file uploads.
- Category
- Developer tools
- Runs
- In your browser
- Cost
- Free · no sign-up
- Availability
- Ready to use
Runs entirely in your browser
Works with queries, mutations, subscriptions, fragments, and schema definitions. Selection sets get one field per line, while arguments, variables, lists, and input objects stay on one line with commas. Comments are kept when pretty-printing and removed when minifying. Nothing is uploaded.
Variables
Prefer variables, such as $id, to values written into the query; the query stays the same and can be cached, and values are passed as JSON.
JSON
To format the JSON a GraphQL API returns, use the JSON formatter.
How to use it
- Paste your GraphQL.
- Choose pretty or minified output and the indentation.
- Copy the result.
Privacy & limitations
Everything stays in your browser.
Related tools
Frequently asked questions
Does it check that my query is valid?
It checks the syntax it needs to format, such as closed strings, but not against a schema; a server or IDE does that.
Are commas required in GraphQL?
No: commas are ignored like spaces, so the formatter adds them only where they make arguments easier to read.
Can it format a schema?
Yes: type, input, enum, interface, and union definitions are formatted the same way.
Free tool · runs in your browser · no account required