Raw GraphQLpaste or type · or drop a .graphql file
Formatted GraphQL
Fix the error in your input to see formatted output

Why format GraphQL?

A GraphQL query minified into one line by a client library or browser devtools network tab is hard to read, especially with nested selections and fragments. This formatter parses the document into an AST with the reference graphql-js parser and re-prints it with consistent 2-space indentation, so any nesting depth stays readable.

One formatter, every document type

GraphQL uses the same syntax family for operations and schemas, so a single parse-and-print pass handles all of them: queries, mutations, subscriptions, fragments, and SDL type definitions (type, input, enum, interface).

Operationsquery, mutation, subscription — with variables and arguments
Fragmentsfragment ... on Type { } and ...spread usage
SDLtype, input, enum, interface, union definitions

Common use cases

Paste a minified query copied from a network tab or a GraphQL Playground/Apollo Studio history entry to make it readable before pasting it into a PR description or documentation.

Backend developers use it to clean up SDL pasted from a schema-first API definition. Everything runs locally, so it is safe to paste queries containing internal field or type names.

Frequently asked questions

No. The reference parser builds an AST from your document and the printer regenerates text from that AST alone; a # comment carries no meaning in GraphQL's type system, so it's dropped rather than preserved, the same way whitespace and blank lines are also not literally preserved between passes.