GraphQL Beautifier
Format a GraphQL schema with two-space indentation, one field per line and a blank line between definitions. Comments are dropped.
What the GraphQL Beautifier does
Definition order and field order are preserved exactly; only whitespace and layout change. That is what makes the output diffable against the input.
A field argument default is not modelled, so an argument is printed with its name and type only.
Comments and descriptions are dropped, and directive usages are dropped: this prints the schema's shape, not its annotations. Run it as a formatting step, not as a lossless round trip.
How to use it
Paste the schema into the GraphQL schema box, or press Run with the example already there.
Read the Formatted schema below: definitions are separated by one blank line and every field is on its own line.
Check that the Formatted schema keeps the field order you wrote — the formatter reflows whitespace and never reorders.
Worked example
Input:
type Query { me: User } type User { id: ID! name: String }
Output:
type Query {
me: User
}
type User {
id: ID!
name: String
}
Why it runs in your browser
The result is produced on this page with JavaScript, so it works offline after the page loads and nothing you enter is sent anywhere.
A schema printed the same way every time: two-space indentation, one field per line, arguments inline and one blank line between definitions.
The formatter parses before it prints, so a schema it cannot read is refused with the line number rather than reflowed into something that looks formatted.
What it does, and what it does not
Definition order and field order are preserved exactly; only whitespace and layout change. That is what makes the output diffable against the input.
A field argument default is not modelled, so an argument is printed with its name and type only.
Comments and descriptions are dropped, and directive usages are dropped: this prints the schema's shape, not its annotations. Run it as a formatting step, not as a lossless round trip.
How to use GraphQL Beautifier
Paste the schema into the GraphQL schema box, or press Run with the example already there.
Read the Formatted schema below: definitions are separated by one blank line and every field is on its own line.
Check that the Formatted schema keeps the field order you wrote — the formatter reflows whitespace and never reorders.
What to Expect
Best for
- Normalising a schema before reviewing it
- Making a minified schema readable
Not ideal for
- Preserving comments, which are dropped
- A lossless round trip through a formatter
What this tool keeps
- Definition and field order
- Argument names and types
What may need cleanup
- Re-add the comments the formatter dropped
- A default value on an argument is not printed
Common errors
- The page refuses it: expected a type name, found "}"
Example use cases
- Formatting a schema for a pull request
- Reading a one-line schema someone pasted
Sample input
GraphQL schema: type Query { me: User } type User { id: ID! name: String }
Sample output
Formatted schema: type Query { …
Who this is for
- Anyone reviewing a schema diff
- Developers tidying a schema they inherited
Frequently asked questions
Does it reorder my types?
No. Definitions and fields are printed in the order the schema declares them; only whitespace changes, which keeps the diff about layout rather than content.
Why are comments gone?
The parser reads types and fields, not prose. A comment is not part of a schema's shape, so the formatted output does not carry it.
What does it do with a syntax error?
It refuses and names the line and the token it found, so a broken schema is reported instead of half-formatted.
Build custom tools for your store
Join the SDK program to create useful ecommerce utilities for your store.