Skip to main content
{/}codefunc

GraphQL Formatter

Format GraphQL queries, mutations, and fragments for readability.

About this tool

Format GraphQL queries, mutations, and fragments for readability. Useful when reviewing API responses, cleaning config before commit, or sharing readable snippets in docs and PRs.

Paste a GraphQL query, mutation, or fragment (compact one-liners are fine). Click Format to indent selection sets and arguments. Example — Pretty-print a compact query: try `query{hero{name friends{name}}}` and expect something like `query { hero { name friends { name } } }`.

Formatting is brace/indent based — it does not validate against a schema. See also: JSON Formatter, and JSON to TypeScript. Runs in your browser — nothing you paste gets uploaded.

How to use

  1. Paste a GraphQL query, mutation, or fragment (compact one-liners are fine).
  2. Click Format to indent selection sets and arguments.
  3. Review field names and nested braces before pasting into a client or playground.
  4. Re-format after edits so diffs stay readable in code review.

Example

Pretty-print a compact query

Input

query{hero{name friends{name}}}

Output

query {
  hero {
    name
    friends {
      name
    }
  }
}

Limitations

  • Formatting is brace/indent based — it does not validate against a schema.
  • Comments (# / //) are stripped during format.
  • Unusual SDL edge cases may need a GraphQL language parser in your toolchain.

Related guides

1

Related tools

2

Frequently asked questions

What does the GraphQL Formatter do?

Format GraphQL queries, mutations, and fragments for readability. Runs in your browser — no install, no account.

How do I use the GraphQL Formatter?

Paste a GraphQL query, mutation, or fragment (compact one-liners are fine). Click Format to indent selection sets and arguments. Review field names and nested braces before pasting into a client or playground. Re-format after edits so diffs stay readable in code review.

Is the GraphQL Formatter free?

Yes. No signup, no usage limits, no paywall.

Does the GraphQL Formatter upload my data?

No. Processing happens locally in JavaScript. Your input is not uploaded, stored, or logged.

What are the limitations of the GraphQL Formatter?

Formatting is brace/indent based — it does not validate against a schema. Comments (# / //) are stripped during format. Unusual SDL edge cases may need a GraphQL language parser in your toolchain.

Search tools

Find a developer tool