GraphQL Formatter

Format and beautify your GraphQL queries and schemas. Free online tool to clean up messy GraphQL code.

GraphQL Input
Formatted Output

Format GraphQL Instantly

Format, indent, and beautify your GraphQL queries and schemas online. Uses Prettier engine.

Prettier Engine

Uses the official Prettier GraphQL parser for industry-standard formatting.

Auto Indent

Corrects nested fields and arguments with proper indentation.

Syntax Check

Validates your query structure before formatting to catch missing braces or errors.

Schema Support

Works perfectly with both Queries/Mutations and SDL Schema Definitions.

How this GraphQL Formatter works

This tool strictly formats GraphQL queries, mutations, and schema definitions to ensure they adhere to standard indentation and spacing rules. It improves readability by organizing fields, arguments, and directives into a clean hierarchy. The tool uses the official Prettier formatting engine to guarantee industry-standard output. Features include syntax validation to catch errors before formatting and the ability to copy the clean code for use in playgrounds like GraphiQL or Apollo Sandbox. Essential for developers cleaning up queries from network logs or sharing snippets with team members.

How to Use

1

Paste Query

Paste your messy GraphQL query or schema.

2

Format

Click Format button to apply Prettier formatting.

3

Copy

Copy the clean, indented output.

Example Usage

Here's a typical example of how this tool transforms your data:

Input
query { user { name } }
Output
query { user { name } }

Frequently Asked Questions

Does it support schema definitions?
Yes, it formats queries, mutations, subscriptions, and SDL (schema definition language) type definitions.
Is it compatible with Apollo?
Yes, the formatted output is standard GraphQL valid for Apollo, Relay, or any other client.

Related Tools

The GraphQL Formatter is maintained by CodeItBro. We aim to provide the best free developer tools on the web. If you have feedback or suggestions, please visit our contact page.