GraphQL Formatter
Format a GraphQL query, fragment or schema locally. Choose indentation and print width, review line-aware errors and download a GraphQL file.
Format a Catalog Query and Check Its Structure
GraphQL Formatter: how to use it
- Paste GraphQL, open a UTF-8 file or load one of the examples.
- Choose indentation and print width, then select Format GraphQL.
- 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.