GraphQL Formatter
Pretty-print GraphQL queries, mutations, and schema SDL with consistent spacing — client-side, using the graphql package.
About this tool
The GraphQL Formatter parses any GraphQL document — a query, mutation, subscription, fragment, or full schema SDL — and re-prints it using GraphQL's canonical formatting rules: consistent indentation, one field per line for multi-field selections, and normalized spacing around arguments and type annotations.
This tool uses the official graphql-js reference implementation's parse() and print() functions, the same parser used by Apollo, Relay, and virtually every GraphQL server and client library. Because it's the reference parser, formatting output matches exactly what other GraphQL tooling expects — there's no risk of a formatter-specific quirk introducing incompatibility. If your input has a syntax error — a missing closing brace, an invalid argument, a malformed type reference — the error message includes GraphQL's own detailed diagnostic, often with the line number embedded.
Everything runs client-side in your browser; your query text and schema never leave the tab, which matters when working with internal API schemas or queries containing business-specific field names. Common uses: cleaning up a minified query copied from a network request inspector, formatting a hand-written schema SDL file for a README, or verifying that a GraphQL fragment is syntactically valid before pasting it into code.
