Skip to content
GraphQL → Formatted or minifiedDeveloper tools

GraphQL Formatter

Format or minify GraphQL queries, mutations, fragments and schemas. Comments kept, clear indentation, and broken brackets or strings shown with line and column. No upload.

About this tool

About GraphQL Formatter

GraphQL Formatter turns a GraphQL query that is squeezed onto one line, copied from a network log or written in a hurry into neat, indented text, and can also do the opposite. Paste a query, mutation, subscription, fragment or a schema with type, input, enum, interface, union and scalar definitions, or open a .graphql file. In Format mode every field goes on its own line, nested selections are indented by 2 or 4 spaces, arguments stay on the line of their field with commas between them, and each definition is separated by an empty line. Comments that start with # are kept on their own lines, descriptions in quotes or triple quotes stay above the field or type they describe, and fragment spreads (...Name) and inline fragments (... on Type) are laid out like fields. Minify mode does the opposite: it removes every space, comma and line break that is not needed, which gives the shortest text to send in a GET request or store in code; comments are left out there. The tool checks the form of the GraphQL as it goes. A bracket that is never closed or closed by the wrong kind, a string without its closing quote, or a character that GraphQL does not allow is reported with its line and column, with that line shown and an arrow under the spot. When everything is in order, it lists the operations, fragments and type definitions it found. It does not know your server’s schema, so whether a field exists is still checked by your GraphQL server. Formatting the result again gives the same text, so it is safe to use before a commit. Everything runs in your browser.

GraphQL Formatter tool

When a GraphQL formatter helps

Readable queries and schemas

Debugging requests

Read a query copied from the network tab.

ExampleOne line to an indented tree.

Before a commit

Consistent .graphql files.

ExampleIndent 2 spaces.

Documentation

Clean examples for an API guide.

ExampleComments kept.

GET requests

Short queries in the URL.

ExampleMinify.

Schema review

Types and enums laid out clearly.

ExampleOne field per line.

Finding a typo

A missing bracket or quote.

ExampleLine 3, column 10.

GraphQL tips

Cleaner GraphQL

Name your operations

query GetUser is easier to find in logs than an anonymous query.

Use variables

Pass $id instead of writing values into the query, so it can be cached and reused.

Fragments for repeats

Put fields you ask for often in a fragment and spread it with ...Name.

Commas are optional

GraphQL ignores commas; the formatter adds them only between arguments for reading.

Build a query

Pick fields to make a query.

Open Query Builder

Format JSON results

Tidy the response too.

Open JSON Formatter
Built & tested by

HemantInsights

Senior Software Engineer · Developer of Toolyconvert

Hemant developed GraphQL Formatter and tests it on desktop and mobile with real files. He is a senior software engineer from Dehradun, India, building websites since 2014, and designed and developed Toolyconvert end to end.

Last updated 29 November 2026

Answers and guidanceFrequently Asked Questions
How do I format a GraphQL query?
Paste it and choose Format. Each field goes on its own line with nested fields indented; copy the result or save it as a .graphql file.
Does it format schemas too?
Yes. Type, input, enum, interface, union, scalar and directive definitions are laid out, with descriptions kept above their fields.
Are comments kept?
Yes when formatting. Minifying leaves comments out, because they are not needed to run the query.
Does it check that fields exist?
No. It checks the form (brackets, strings and characters). Your GraphQL server checks fields against its schema.
What does minify do?
It removes spaces, commas and line breaks that are not needed, giving the shortest query with the same meaning.
Why do I see an error?
A bracket is not closed or closed by the wrong kind, a string has no closing quote, or a character is not allowed. The line and column show where.
Is my query uploaded?
No. It is formatted in your browser.
More tools for your workflowRelated Tools

GraphQL Query Builder

Build GraphQL queries, mutations and subscriptions from a simple indented field list, with typed variables, fragments, a field list made from a JSON response, and ready fetch, curl and Apollo code.

JSON Formatter

Format, validate and minify JSON: 2 spaces, 4 spaces or tabs, sort keys, see the exact line and column of errors, fix trailing commas and quotes, copy or download.

JSON to TypeScript Converter

Paste JSON and get TypeScript interfaces or types: nested interfaces, optional keys, unions and quoted keys. Updates as you type.

YAML Viewer

Check YAML and see it as a tree you can open and close. Find keys and values, copy a key’s path, read several documents, and get the same data as JSON. Nothing is uploaded.

1 / 3
Browse all developer tools

Featured on

Toolyconvert is listed on these product directories and launch platforms.