GraphQL Formatter

Format or minify GraphQL queries and schemas, validate syntax and extract operations.

Your GraphQL queries, schemas and variables are processed locally in your browser and nothing is uploaded to a server.

Need to tidy a request body? Try the JSON Formatter.

About GraphQL Formatter

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

How to use the GraphQL Formatter

  1. Paste your GraphQL query, mutation or schema into the input box.
  2. Choose Format to beautify or Minify to compact the document.
  3. Optionally paste a variables JSON object to pretty-print it.
  4. Review extracted operation names and any syntax error.
  5. Copy the formatted or minified result from the output panel.

Example

Input

query Hero($ep:Episode){hero(episode:$ep){name friends{name}}}

Output

query Hero($ep: Episode) {
  hero(episode: $ep) {
    name
    friends {
      name
    }
  }
}

Format mode beautifies a compact query into indented GraphQL.

Common errors & troubleshooting

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

All ArrayKit tools