GraphQL Formatter

Format GraphQL queries, mutations, fragments, and schema definitions into clean, readable GraphQL.

GraphQL input

Paste queries, mutations, subscriptions, fragments, or schema SDL.

Processed locally in your browser Limit Browser memory. Your input is processed in your browser and is not uploaded or sent to a server. Avoid pasting production secrets, access tokens, private keys, passwords, or sensitive customer data unless you understand the risk.
Indentation

Formatted GraphQL

Readable output with syntax parsing before formatting.

Ready to format GraphQL

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

Beautify GraphQL documents locally

Use this formatter to normalize whitespace and indentation for GraphQL operations, fragments, subscriptions, and schema definition language without sending documents to a server.

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.

Queries, mutations, and subscriptions

Queries read data, mutations describe changes, and subscriptions describe streamed updates. Formatting keeps each selection set and variable definition clear without executing the operation.

Fragment formatting

Fragments are reusable field selections. A formatter makes spreads, inline fragments, and shared fragment definitions easier to review alongside the operation that uses them.

Schema SDL formatting

GraphQL SDL defines types, inputs, enums, interfaces, unions, directives, and schema roots. Formatting SDL helps teams review API shape changes and generated schemas.

GraphQL Formatter vs OpenAPI tools

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.

Common syntax errors

Missing braces, incomplete variable definitions, invalid fragment spreads, misplaced commas, and unfinished strings can stop parsing until the GraphQL text is corrected.

GraphQL Formatter FAQ

Does this GraphQL Formatter run my query?

No. It treats GraphQL as source text only. It does not call APIs, introspect schemas, fetch endpoints, resolve variables, or execute operations.

Can it format schema definitions?

Yes. GraphQL SDL such as type, input, enum, interface, union, directive, and schema definitions can be formatted alongside operation documents.

Are GraphQL comments preserved?

Yes. Comments are preserved by the formatter where GraphQL parsing supports them, so notes in queries and schema SDL remain in the output.

How is this different from JSON Formatter?

JSON Formatter expects JSON syntax. GraphQL Formatter understands GraphQL selections, variables, fragments, directives, and schema definitions.