Format
Rewrites your GraphQL with Prettier, the standard GraphQL formatter. It fixes indentation and spacing so schemas and queries are even and easy to read.
type Query{me:User posts:[Post!]!}Aftertype Query {
me: User
posts: [Post!]!
}Paste a GraphQL schema or query and get it back clean and easy to read. The formatter is Prettier, running in your browser, so your GraphQL stays on your device.
Format uses Prettier, the standard GraphQL formatter.
The formatter reads your GraphQL and rewrites it in a clean, even style. It fixes indentation, tidies spacing, and lines up fields and arguments so a schema or query is easy to scan. It changes only the layout, never the types, fields, or operations themselves.
Rewrites your GraphQL with Prettier, the standard GraphQL formatter. It fixes indentation and spacing so schemas and queries are even and easy to read.
type Query{me:User posts:[Post!]!}Aftertype Query {
me: User
posts: [Post!]!
}Works on both GraphQL schema files (type, input, enum, and interface definitions) and operation documents (query, mutation, and subscription).
Schema or query, any layoutAfterOne clean, even styleChoose 2 or 4 spaces per level. Two spaces is the common GraphQL default, but you can pick whichever matches the rest of your project.
Mixed or no indentationAfterEven, consistent indentationA formatter helps whenever you have GraphQL that is hard to read or does not match your project's style. These are the cases that come up most:
If you are still getting comfortable with schemas, types, and queries, the learn section on graphql.org is a friendly place to start. For the fine print, the GraphQL specification sets out the exact syntax, which is the same syntax this formatter parses.
The clean layout itself is the work of Prettier, which formats GraphQL alongside many other languages.
If you work across formats, these formatters run the same way, right in your browser: