GraphQL Formatter

Tidy GraphQL queries and mutations.

Category: Dev Tools

When to use?

Use it to tidy a one-line GraphQL query or mutation into a form suited to review and documentation.

How to use

  • Enter the GraphQL document.
  • It tidies with a Prettier GraphQL parser.
  • Copy the result.

Input Explanation

Enter a GraphQL string with query, mutation, or fragment syntax.

Calculation Basis

It uses the Prettier GraphQL plugin to output nested fields and arguments with consistent line breaks.

Usage Examples

  • Review queries - Make a long GraphQL request readable.
  • Quick pre-deploy check - Check inputs and output to reduce errors before dev/ops work.
  • Aid docs/reviews - Copy the result into dev docs, issues, or review comments.

Examples

  • query{viewer{id name}} → a multi-line query
  • A one-line query → indented by field hierarchy

Cautions

  • Generated output is for reference; test carefully before production use.
  • GraphQL tidying runs only in the browser and is not sent out.

FAQ

Are fragments supported?

Syntax supported by the Prettier GraphQL parser is handled.

Is the pasted query sent out?

No. GraphQL tidying runs only in the browser.

Are variables and aliases tidied?

It tidies query variables, aliases, and nested fields with indentation for readability.

Is schema (SDL) tidied?

It focuses on queries and mutations; schema with type definitions may be handled differently.

Related Tools

  • GraphQL Variable Merger - Merge a GraphQL query and variables JSON into an API request body.
  • JSON Formatter - Beautify or minify JSON strings instantly and check for validity errors.
  • Code Diff Tool - Compare two code or text inputs line by line to show additions and deletions.
  • UUID Generator - Generate up to 20 cryptographically secure UUID v4 values at once.
  • Password Generator - Generate secure random passwords in the browser by choosing length, character set, and count.
  • JWT Decoder - Decode a JWT header and payload to view the JSON and key claims.