What is a GraphQL formatter?
A GraphQL formatter parses GraphQL text and prints a consistent layout so nested selections, variables, directives, fragments, and type definitions are easier to read.
Format GraphQL queries, mutations, fragments, and schema definitions into clean, readable GraphQL.
Paste queries, mutations, subscriptions, fragments, or schema SDL.
Readable output with syntax parsing before formatting.
Paste GraphQL or load a sample. Operations, fragments, and schema SDL are treated as local text only.
Tip: Press Ctrl+Enter or Command+Enter in the editor to format immediately.GraphQL Formatting Guide
Use this formatter to normalize whitespace and indentation for GraphQL operations, fragments, subscriptions, and schema definition language without sending documents to a server.
A GraphQL formatter parses GraphQL text and prints a consistent layout so nested selections, variables, directives, fragments, and type definitions are easier to read.
Queries read data, mutations describe changes, and subscriptions describe streamed updates. Formatting keeps each selection set and variable definition clear without executing the operation.
Fragments are reusable field selections. A formatter makes spreads, inline fragments, and shared fragment definitions easier to review alongside the operation that uses them.
GraphQL SDL defines types, inputs, enums, interfaces, unions, directives, and schema roots. Formatting SDL helps teams review API shape changes and generated schemas.
GraphQL documents use GraphQL syntax, while OpenAPI tools inspect JSON or YAML API descriptions. Use this page for GraphQL operations and SDL, not REST API specs.
Missing braces, incomplete variable definitions, invalid fragment spreads, misplaced commas, and unfinished strings can stop parsing until the GraphQL text is corrected.
No. It treats GraphQL as source text only. It does not call APIs, introspect schemas, fetch endpoints, resolve variables, or execute operations.
Yes. GraphQL SDL such as type, input, enum, interface, union, directive, and schema definitions can be formatted alongside operation documents.
Yes. Comments are preserved by the formatter where GraphQL parsing supports them, so notes in queries and schema SDL remain in the output.
JSON Formatter expects JSON syntax. GraphQL Formatter understands GraphQL selections, variables, fragments, directives, and schema definitions.