Developer tools

GraphQL Query Formatter

Paste a minified GraphQL query, mutation or subscription and get it re-indented with two spaces per depth level, plus a quick structural validity check.

Raw GraphQL

Formatted output

Paste GraphQL on the left and press Format.

Formatting runs locally — nothing you paste is sent anywhere.

{ }

String-aware tokenizer

Braces and quotes inside string arguments are never mistaken for structure, so formatting stays accurate.

Pinpoint validation

A mismatched brace, bracket or parenthesis is reported with its exact line and column.

📋

Copy in one click

Grab the formatted query instantly, ready to paste into your codebase or documentation.

How to use the GraphQL query formatter

Turn a minified or inconsistently indented operation into something reviewable in one step.

  1. Paste your GraphQLDrop a query, mutation, subscription or fragment into the left panel.
  2. Press FormatThe tokenizer re-indents every field and argument by nesting depth.
  3. Copy the resultCopy the formatted output, or fix the reported line and column if something didn't balance.

How the formatter works

Rather than relying on a full GraphQL parser, this tool tokenizes the input character by character, tracking whether it is inside a string literal and how deep the current brace, bracket or parenthesis nesting is. That is enough information to safely re-indent real-world GraphQL without ever needing a schema.

Depth-based indentation

Every time the tokenizer opens a brace, parenthesis or bracket, the indent level increases by one; closing one decreases it, so each line reflects exactly how nested it is.

One field per line

Selection sets are split so each field, argument block or fragment spread gets its own line instead of being crammed together.

String literal safety

Quoted strings are tracked as a single unit, including escaped quotes, so their contents are never reformatted or misread as structure.

Structural validation

The same pass counts open and close tokens; the first one that does not have a matching partner is reported with its line and column.

GraphQL query formatter FAQ

Questions about validation, supported operations and privacy.

Does this formatter validate my GraphQL against a schema?

No. It performs structural validation only, checking that braces, parentheses and brackets are balanced and properly nested. It does not know your schema, so it cannot catch invalid field names or types.

Does it work on mutations and subscriptions, not just queries?

Yes. The formatter re-indents any GraphQL operation, including query, mutation, subscription and fragment definitions, the same way.

What happens if my query has mismatched braces?

The tool reports the line and column where it first detects an unmatched or misordered brace, bracket or parenthesis, so you can jump straight to the problem instead of scanning the whole query.

Will formatting change string literals or values inside my query?

No. The tokenizer tracks string literals so that braces or quotes inside a string argument are never treated as structural characters, and the string contents are copied through unchanged.

Is my query sent to a server?

No. Parsing and formatting run entirely in your browser with a hand-written tokenizer. Nothing you paste here is stored or transmitted.