ToolSnippet

Prettify & Minify GraphQL Queries

Format, clean, and indent GraphQL queries, mutations, and fragments, or minify into single-line POST bodies.

About This Tool

GraphQL Query Prettifier formats unreadable or minified GraphQL queries with clean indentation, and compresses multi-line queries into single-line strings suitable for HTTP POST payloads.

Key Features

GraphQL query and mutation prettifier
Single-line query minification
Query variables JSON editor
One-click copyable formatted output

How to Use This Tool

  1. Paste your GraphQL query, mutation, or fragment.
  2. Optionally enter query variables in the JSON editor.
  3. Click 'Prettify Query' for formatted view or 'Minify for POST Body' for compact output.

Why Use This Tool

  • Improves GraphQL code readability in PRs and documentation, and optimizes payload sizes for network transmission.
  • Strips comments and formats nested selections automatically.

Pro Tips

  • Use GraphQL fragments to reuse common field selections across multiple queries

Frequently Asked Questions

Why should I minify GraphQL queries for production?

Minifying queries removes extra whitespace and comments, reducing HTTP request payload size and saving bandwidth across high-throughput APIs.

Related Tools