Code · Made a little simpler

GraphQL Formatter

Format a GraphQL query, fragment or schema locally. Choose indentation and print width, review line-aware errors and download a GraphQL file.

Free to useNo account neededProcessed on your device
Your workspaceProcessed on your device

Add this tool to your website

Paste this code into your page to add the tool and a visible ToolMellow credit link.

HTML embed code
Preview embed

GraphQL Formatter: how to use it

  1. Paste GraphQL, open a UTF-8 file or load one of the examples.
  2. Choose indentation and print width, then select Format GraphQL.
  3. Review the formatted document and copy it or download the GraphQL file.

Limits and notes

Accepts up to 200,000 UTF-16 code units using the GraphQL parser bundled with Prettier 3.9.9. Uses two, four or eight spaces and a print width from 40 to 160. The parser checks syntax locally. Schema-specific validation depends on the schema used by your application.

How your privacy works →

GraphQL Formatter: common questions

Does formatting change operation names or directives?

The tool compares the parsed definition trees before and after formatting and keeps definition and selection order.

Why does a block description occupy more lines?

The printer can lay out the triple-quoted string differently while preserving the value GraphQL reads from it.

What does the location in a syntax error mean?

Line and column identify where the GraphQL parser detected unexpected input. Check the surrounding delimiters to find its cause.

Guides