GraphQL Formatter

Format GraphQL queries, mutations, subscriptions, and SDL. Comments are removed — review output before sharing.

  • Runs entirely in your browser
  • No data stored or sent to a server
  • Free forever — no signup
  • Instant conversion

Input and Output

Use the interactive encoder and decoder on this page to process your text.

Learn more about JSON formatting

How to Format GraphQL Queries

GraphQL Formatting

When to Format GraphQL

Beautify minified GraphQL queries from network tabs, normalize pasted schema snippets, or prepare operations for documentation and code review. Consistent indentation makes nested selections, fragments, and variable definitions easier to read during API debugging.

What Gets Formatted

Queries, mutations, subscriptions, and schema definition language (SDL) fragments are supported. The formatter adds line breaks and indentation around fields, arguments, directives, and inline fragments without changing query semantics. Comments (#) are removed during formatting.

Developer Tips

  • Format before sharing GraphQL operations in tickets or API docs
  • Fix syntax errors before formatting — invalid GraphQL may not beautify cleanly
  • Pair with your GraphQL client to verify formatted queries still execute correctly

Frequently asked questions

Does formatting change query results?

No. Whitespace in GraphQL documents is not significant. Only readability changes.

Are comments preserved?

No. GraphQL comments are removed when the document is parsed and re-printed. Keep a copy of commented source if you need the annotations.

Are GraphQL variables and fragments preserved?

Yes. Variable definitions, named fragments, and directives are kept intact during formatting.