Indent and validate a GraphQL query

Developers use GraphQL Formatter before a code review, debugging session or handoff to another contributor.

Indent and validate a GraphQL query, so reviews, edits and debugging become easier. Use it for free in your browser, with no account required.

How to use

  1. Paste your GraphQL query into the input area, or import a .graphql or .gql file.
  2. Check that the query is complete and that the braces are balanced before you start formatting.
  3. Run the formatter to indent the query and spot a possible syntax error.
  4. Compare the output with the original to make sure the meaning of the query has not changed.
  5. Clear the content before moving on to another query or file.

Example

A developer pastes a read query with several nested fields, then formats it before a review. They check that the fields keep the same logical order and that the indentation makes each block easier to read.

Limits and formats

Where processing happens

Formatting happens locally in your browser. The query you paste or import is not sent outside and stays on your device during the operation. You can prepare a code review or fix indentation without creating an account.

Frequently asked questions

Does it validate against my schema?

No, it works on the syntax of the query. It can flag incorrect writing, but it does not know whether fields exist in your schema or whether types match your API.

Can I format a mutation or subscription?

Yes, as long as the text follows GraphQL syntax. Formatting applies to the structure of the query, whether it is a read, a mutation or a subscription, without executing the operation.

Why is my query not formatted?

A syntax error, a missing character or content that is not GraphQL can prevent a clean result. Fix the part that is flagged first, then run the formatter again on a complete query.

Tools in the same category