GraphQL Formatter
Format, validate, and minify GraphQL queries, mutations, and schemas online with configurable indentation and precise syntax error locations.
Loading tool...
What is GraphQL Formatter?
A GraphQL formatter beautifies GraphQL code by parsing it with the official reference parser and reprinting it with consistent indentation. It validates syntax, normalizes style, and can minify operations by stripping comments and whitespace β all locally in your browser.
Key Benefits
- Readable nested queries
- Syntax validation
- Custom indentation
- One-click minify
Common Use Cases
- β’Reviewing API queries
- β’Debugging resolver payloads
- β’Preparing persisted queries
- β’Cleaning up SDL schemas
How to Format GraphQL
- Paste your GraphQL: Paste the query, mutation, or schema to format.
- Choose mode and indentation: Pick pretty print or minify, then 2 spaces, 4 spaces, or tabs.
- Click Format: Press Format GraphQL to validate and process the input.
- Copy the result: Copy the formatted GraphQL output for your project.
Key Features
- Pretty print GraphQL with 2-space, 4-space, or tab indentation
- Minify queries by stripping comments, whitespace, and optional commas
- Validate syntax with the official GraphQL reference parser
- Support queries, mutations, subscriptions, fragments, and SDL schemas
- Show precise syntax error locations with line and column numbers
- Copy formatted output instantly with fully local processing