Runs 100% in your browser — nothing is uploaded
Formatters & Minifiers

GraphQL Formatter

Pretty-print GraphQL queries, mutations, and schema SDL with consistent spacing — client-side, using the graphql package.

GraphQL Formatter
Client-side

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.

FAQ

Does this tool execute my GraphQL query against a server?
No. This tool only parses the query syntax and re-prints it — it never sends the query to any GraphQL endpoint or executes it. It is purely a formatting and syntax-validation tool.
Can I format a full schema (SDL) as well as a query?
Yes. The graphql-js parser used here handles both operation documents (query/mutation/subscription) and Schema Definition Language (type, interface, enum, input, scalar, directive definitions) — paste either and it will format correctly.
Why does it say my GraphQL is invalid?
Common causes: mismatched braces, a field argument missing its value, an unterminated string, or using a reserved keyword incorrectly. The error message comes directly from the graphql-js parser and typically names the exact token and position that caused the failure.
Does formatting change field order or values?
No. Formatting only affects whitespace, indentation, and line breaks. Field order, argument values, directives, and fragment references are preserved exactly as written.
Can I format GraphQL with variables and directives?
Yes — variable definitions, directives (@include, @skip, or custom ones), fragments, and inline fragments are all fully supported since the tool uses the complete GraphQL grammar, not a subset.