AIWalay Tools

GraphQL Formatter

Format and validate GraphQL queries, mutations and schemas. Consistent indentation, syntax checking with line numbers, copy or download. In-browser.

About the GraphQL Formatter

This GraphQL formatter tidies up queries, mutations, subscriptions and schema definitions with consistent indentation and line breaks. Paste a query that's been squashed onto one line or inconsistently indented, and get clean, readable GraphQL you can copy or download.

It tokenizes GraphQL the right way — handling strings, block strings (triple-quoted), comments, variables, directives and the spread operator — then re-indents by selection-set depth. A validate mode checks the syntax and delimiter balance (braces, parentheses, brackets and strings), reporting the exact line of any problem so you can fix malformed queries quickly.

Choose 2-space, 4-space or tab indentation to match your project. Because it's a dependency-free, in-browser formatter, nothing is uploaded — safe for internal schemas and queries against private APIs. Note that validation is structural, not schema-aware.

How to Use the GraphQL Formatter

  1. 1Paste a GraphQL query, mutation or schema into the input box.
  2. 2Choose your indentation (2 spaces, 4 spaces or tabs).
  3. 3Click Format to beautify, or Validate syntax to check for errors.
  4. 4Copy the formatted result or download it as a .graphql file.

Frequently Asked Questions

Does it validate my query against a schema?

No — validation here is structural. It checks that the GraphQL is syntactically well-formed and that braces, parentheses, brackets and strings are balanced, reporting the line of any issue. It doesn't know your schema, so it can't verify that fields or types actually exist.

Can it format a schema definition, not just queries?

Yes. It recognises type, interface, enum, input, union, scalar and other schema keywords, so SDL (Schema Definition Language) files format cleanly alongside operation documents.

Are block strings and comments preserved?

Yes. Triple-quoted block strings (often used for field descriptions) and # comments are tokenized and kept intact during formatting, so documentation in your schema survives.

Is my query sent anywhere?

No. Formatting and validation run entirely in your browser, so queries against private endpoints and unpublished schema files stay on your device.

Related Tools