GraphQL Query Beautifier & Minifier (Schema & Operation Formatter)

Sample:
Indentation:
513 characters
query GetCustomerAnalytics($customerId: ID!, $startDate: String!, $withDetails: Boolean = true) {
   customer(id: $customerId) {
     id companyName tier status billingAccount {
       currency balance invoices(limit: 5) {
         invoiceNumber issuedAt totalAmount isPaid
      }
    }
    activityLogs(startDate: $startDate)
    @include(if: $withDetails) {
       timestamp action ipAddress metadata {
         browser os
      }
    }
  }
}
Operation TypeQUERY
Max Depth4 levels
Estimated Fields37 fields
Character Count445 chars

100% Private In-Browser Parsing

Your schema definitions, proprietary mutations, and authorization headers are formatted locally without sending any data to remote servers.

Full Spec Compliance

Standardizes queries, mutations, subscriptions, fragments, aliases, variables, and schema definition language (SDL) tokens.

HTTP Payload Minification

Strips # comments and condenses whitespace into a minimal single-line payload to conserve POST request bandwidth.

Technical Reference & Architecture Guide

GraphQL Query Formatting & Minification Guide — Reference Guide

Standardized conventions for indenting, linting, inspecting selection nesting depth, and minifying GraphQL queries, mutations, subscriptions, and SDL schemas.

Key Parameters & Controls

indentSpacesnumber (default: 2)

Number of spaces applied per nested field selection hierarchy level.

minifyModeboolean

Strips comments, collapses spaces, and compacts queries into a minimal payload string.

alphabeticalSortboolean

Optionally sorts sibling fields alphabetically for predictable diffs and review.

Pro Tips & Best Practices

Minifying GraphQL query strings sent over HTTP POST reduces JSON request payload sizes by up to 60%.

Keep query nesting depth below 5 levels in production to protect servers against exponential denial-of-service query attacks.

Use GraphQL variables instead of string interpolation to enable automatic query plan caching on the GraphQL gateway.

Common Gotchas & Troubleshooting

Check that all opened curly braces '{' have a corresponding closing brace '}' and string literals are properly closed.

Directives are formatted with clean inline spacing before selection blocks.

Frequently Asked Questions

Can this tool format mutations and subscriptions as well as queries?▼

Yes. It supports queries, mutations, subscriptions, fragments, and GraphQL SDL schema definition language.

Does formatting modify variable names or argument values?▼

No. Token identities and values are strictly untouched; only indentation and whitespace are standardized.

Are my schemas or queries uploaded anywhere?▼

No. The GraphQL tokenizer and tree reconstruction run 100% locally in your browser memory.

How does the minifier handle GraphQL comments (#)?▼

Minification automatically strips all single-line comments prefixed with the '#' character.

Related Tools & Utilities

All Tools →