GraphQL Formatter
Format GraphQL queries and schema definitions
What is GraphQL Formatter?
A GraphQL formatter expands queries, mutations, and schemas that have been collapsed onto a single line into properly indented code, ready for reading and code review. Parsing is built on Prettier's GraphQL parser and runs locally in your browser.
How to use GraphQL Formatter
- 1Paste a query, mutation, fragment, or schema definition.
- 2The output is indented by selection-set depth, with arguments and directives left in place.
- 3Syntax errors report their exact position, so you can fix them and format again.
Frequently asked questions
Can it format queries and schemas at the same time?+
Yes. The GraphQL query language and the Schema Definition Language (SDL) share the same lexical grammar, so the formatter recognizes and handles both: type, input, and enum definitions indent just as correctly as a query does.
Does formatting change what the query means?+
No. Formatting only adjusts whitespace and line breaks; it never adds or removes fields, reorders arguments, or touches aliases. The query you send to the server is semantically identical before and after.
Related tools
All toolsJSON Formatter
Format, minify, and validate JSON with line-and-column error reporting
JSON Validator
Validate JSON syntax and pinpoint the failing line and column
JSON Viewer
Explore JSON as a collapsible tree and read off access paths
JSON Escape / Unescape
Escape and unescape JSON strings
SQL Formatter
Beautify SQL per dialect, including MySQL and PostgreSQL
XML Formatter
Pretty-print or minify XML while checking that every tag is closed