๐Ÿ”’ Runs in your browser โ€” nothing is uploadedโœ“ Free, no signup

GraphQL Formatter

Paste a GraphQL query, mutation or schema to format it consistently with Prettier โ€” one field per line, clean indentation and readable arguments.

Loading...

0 characters

Formatted GraphQL

Loading...

When should you use the GraphQL Formatter?

  • Reading a minified query copied from network logs
  • Tidying queries before committing them
  • Formatting a GraphQL schema (SDL) file

How to use the GraphQL Formatter

  1. 1

    Paste GraphQL

    Paste queries, mutations, fragments or schema definitions.

  2. 2

    Set indentation

    Choose 2 or 4 spaces or tabs and a line width.

  3. 3

    Check errors

    Syntax errors show the line and column.

  4. 4

    Copy

    Copy the formatted GraphQL.

Examples

One-line query

Before

query{user(id:1){name,friends(first:2){edges{node{id}}}}}

After

query {
  user(id: 1) {
    name
    friends(first: 2) {
      edges {
        node {
          id
        }
      }
    }
  }
}

Common errors and how to fix them

Syntax Error: Expected Name, found <EOF>
The query is incomplete โ€” usually a missing closing brace } or parenthesis ).
Variables are rejected
Variable definitions need a $ and a type, like query GetUser($id: ID!).
Related tools:ย JSON Formatter ยท TypeScript Formatter ยท SQL Formatter

More from Code Formatters & Minifiers

Free tools that run in your browser โ€” no signup, nothing uploaded.

GraphQL Formatter FAQ

Queries, mutations, subscriptions, fragments and schema definitions (SDL), including directives and descriptions.

Prettier, the most widely used code formatter โ€” so the output matches what your editor or CI would produce.

No. It checks GraphQL syntax only, not whether fields exist in your API's schema.

Yes, # comments are preserved.

Use the JSON Formatter for the variables object.

No. Everything runs in your browser, so your query never leaves your device.