GraphQL Formatter — Pretty-Print Queries, Mutations & SDL
Pretty-print GraphQL queries, mutations, and SDL using the official graphql/language parser.
Loading GraphQL parser...
How to use
- 1 Paste a GraphQL query, mutation, subscription, or SDL.
- 2 Beautify reformats with the official <code class="rounded bg-slate-100 px-1 text-xs dark:bg-slate-800">graphql/language</code> printer.
- 3 Minify strips whitespace and comments for compact transport.
- 4 Parse errors include the line and column.
Why use this tool
- Powered by the official <code class="rounded bg-slate-100 px-1 text-xs dark:bg-slate-800">graphql/language</code> parse and print functions — output is canonical SDL.
- Loaded on demand — the parser only downloads when you start typing.
- Both directions — beautify for repo, minify for transport.
- Pure client-side — your query never leaves the browser.
Frequently asked questions
Does this support GraphQL SDL (schema)?
Yes — SDL (Schema Definition Language) is parsed and printed identically. Use it to format full schemas including types, directives, and unions.
Why does the first format take a second?
The GraphQL parser library loads lazily on first input. Subsequent formats are instant.
Will fragments and variables be reordered?
No — the printer preserves your declaration order. Only whitespace and comma layout change.
What is GraphQL Formatter?
A GraphQL Formatter is a tool that pretty-prints GraphQL queries, mutations, and schema definition language using the official graphql/language parser. It parses the input and re-serializes it with consistent indentation and spacing, producing readable, well-structured GraphQL documents in the browser.
Features
AST-based printing
Parses with graphql-js and re-prints from the AST, so output is always syntactically valid.
Queries, mutations & SDL
Formats operations and type definitions alike, including fragments and directives.
100% private
Your GraphQL is parsed on the device and never uploaded.
Example
Input
{ user(id:1){name posts{title}} }
Output
{
user(id: 1) {
name
posts {
title
}
}
}
Common use cases
-
1
Tidy a copied query
Reformat a one-line or messy GraphQL query into a readable, indented form.
-
2
Clean up SDL
Normalize a schema file's spacing before committing or reviewing.
-
3
Validate while formatting
A parse error pinpoints a syntax mistake before you send the query.
Zerethon's GraphQL formatter pretty-prints queries, mutations, and schema definition language (SDL) using the official graphql-js parser. It parses the document into an AST and re-serializes it with consistent two-space indentation and spacing, so malformed input surfaces as a parse error rather than silently reformatting. Everything runs in your browser.
- Category
- Developer
- Pricing
- Free
- Privacy
- Browser-based
- Signup
- Not required
References
- GraphQL Specification — GraphQL Foundation
- graphql-js — reference implementation — GitHub
Privacy
Your data never leaves your browser unless explicitly stated. GraphQL Formatter runs entirely client-side — no server upload, no logging, no tracking of your input.
Related tools
JSON Formatter
Format, validate, and minify JSON online. Free, no signup — your data never leaves your browser.
Open toolSQL Formatter
Format SQL queries online — beautify MySQL, PostgreSQL, SQLite, SQL Server, Oracle, and BigQuery.
Open toolUUID Generator
Generate UUIDs online — v1, v4, v7, and Nil. Bulk generation up to 10,000. Free, no signup.
Open toolPassword Generator
Generate strong, cryptographically random passwords. Configurable length and character sets — runs in your browser.
Open toolBuild, share, and grow on Zerethon Social
Free signup. Earn points, collect achievements, and connect with creators worldwide.