Input

Mode:

Output

What Is a GraphQL Formatter?

GraphQL is a query language for APIs that allows clients to request exactly the data they need. GraphQL queries and schemas can be written as compact single-line strings or as well-indented multi-line documents. This tool formats (prettifies) GraphQL by adding consistent indentation and line breaks, making it easier to read and debug. It also minifies GraphQL by removing all unnecessary whitespace and comments for compact transmission.

Toggle between Format and Minify modes using the mode buttons. All processing runs in your browser — no data is sent to any server.

How to Use This Tool

1

Choose Mode

Select Format to prettify GraphQL with indentation, or Minify to remove whitespace and comments.

2

Paste GraphQL

Paste your GraphQL query, mutation, subscription, or schema into the left editor. Use Sample to load an example, or Upload to load from a file.

3

Copy or Download Result

The right panel updates automatically. Use Copy or Download to save the formatted or minified output.

Example

Formatting a compact GraphQL query:

Input (compact)

Input

Output (formatted)

Output

Frequently Asked Questions

Does this support GraphQL schemas (SDL)?

Yes. The formatter works on queries, mutations, subscriptions, and Schema Definition Language (SDL) documents.

What does minifying GraphQL do?

Minifying removes whitespace, newlines, and comments from GraphQL, reducing payload size for API requests. This is useful in production environments.

Is my data sent to a server?

No. All processing happens locally in your browser.

Can I format GraphQL fragments?

Yes. Named fragments, inline fragments, directives, and variables are all handled by the formatter.

Related Tools

The GraphQL specification is available at spec.graphql.org. See graphql.org/learn for official documentation and tutorials.