This GraphQL formatter pretty-prints and minifies GraphQL queries, mutations and SDL schemas while checking that each document parses cleanly. Paste a raw query and the graphql beautifier indents fields, arguments and selection sets consistently; switch to minify to strip whitespace, commas and comments down to the smallest equivalent document. It also extracts named operations and pretty-prints an attached variables JSON object, so you can tidy a full request in one place and use it as a quick graphql validator. Built for frontend and backend developers, QA engineers and anyone debugging API calls who needs to format a graphql query or prettify a graphql schema before sharing it. Everything runs locally in your browser, so your data never leaves your device and nothing is uploaded to a server.
Features
Format queries, mutations and SDL schemas with clean, consistent indentation
Minify documents by removing whitespace, commas and comments
Validate syntax so malformed queries surface a clear parse error
Extract and list named operations from the pasted document
Pretty-print an attached variables JSON object alongside the query
Switch between Format and Minify modes with one click
Copy formatted or minified output instantly
How to use the GraphQL Formatter
Paste your GraphQL query, mutation or schema into the input box.
Choose Format to beautify or Minify to compact the document.
Optionally paste a variables JSON object to pretty-print it.
Review extracted operation names and any syntax error.
Copy the formatted or minified result from the output panel.
query Hero($ep: Episode) {
hero(episode: $ep) {
name
friends {
name
}
}
}
Format mode beautifies a compact query into indented GraphQL.
Common errors & troubleshooting
Output shows a syntax error after pasting. — The document must be valid GraphQL. Check for unbalanced braces, missing field selections or a stray comma, then reformat.
Operation names panel says no named operations. — Anonymous queries and SDL schemas have no operation names. Add a name like query GetUser { ... } if you need it listed.
Variables box reports invalid JSON. — The variables field expects a JSON object such as { "id": "1000" }, not GraphQL syntax. Use double-quoted keys and valid JSON.
Expecting schema validation against my API. — This tool validates syntax only. It confirms the document parses but does not check fields against a specific schema.
Frequently asked questions
What is the GraphQL Formatter?
The GraphQL Formatter beautifies, minifies and syntax-checks GraphQL queries, mutations and SDL schemas, and extracts named operations — all in your browser.
How do I format a GraphQL query with this tool?
Paste your query, mutation or schema into the input box and choose Format. The GraphQL Formatter re-indents fields, arguments and selection sets so you can copy the clean result.
Does the GraphQL Formatter validate against my schema?
It validates syntax, confirming the query or schema parses. It does not check operations against a specific schema definition.
What does the minify option do?
Minify removes ignored characters such as whitespace, commas and comments to produce the smallest equivalent GraphQL document.
Can the GraphQL Formatter pretty-print my variables too?
Yes. Paste a variables JSON object into the dedicated box and it is formatted alongside your query.
Is my GraphQL query uploaded anywhere?
No. The GraphQL Formatter processes everything locally in your browser, so your queries, schemas and variables never leave your device.
Related tools
JSON Formatter — Beautify, minify and validate JSON with error locations.
SQL Formatter — Format SQL for MySQL, PostgreSQL, SQL Server, SQLite, BigQuery and Oracle.
XML Formatter — Beautify, minify and validate XML, and convert XML ↔ JSON.
JS / TS Formatter — Beautify JavaScript, TypeScript and JSX/TSX with Prettier options, or minify plain JavaScript.