GraphQL Query Minifier

Minify GraphQL queries, mutations, and fragments by stripping comments and redundant whitespace.

  • 100% free
  • Private in browser
  • No signup
  • No watermarks

Minified GraphQL

118 B → 70 B (41% smaller)

query ListProducts($limit:Int){products(limit:$limit){id title price}}

About GraphQL Query Minifier

The GraphQL Query Minifier compresses a GraphQL query, mutation, or fragment into one compact line. It removes # comments, collapses line breaks and indentation, and deletes the spaces around braces, parentheses, colons, commas, and $ signs. The result panel shows the original size, the minified size, and the percentage saved. It is a text-based minifier, not a parser, so it does not validate syntax, and a # or a run of spaces inside a quoted string value will also be changed.

How to use GraphQL Query Minifier

  1. Paste your query into the GraphQL Query or Mutation box.
  2. Read the before and after size under the Minified GraphQL heading.
  3. Check that the one-line output still has every field and argument.
  4. Click Copy Minified and paste it into your request body or code.

Key features

  • Removes # line comments from queries, mutations, and fragments
  • Collapses line breaks, tabs, and indentation into single spaces
  • Deletes spaces around { } ( ) : , and $ tokens
  • Shows original size, minified size, and percent saved
  • Keeps fields, aliases, arguments, and variables in their original order
  • Updates the output as you type, with one-click copy

Frequently asked questions

How do I minify a GraphQL query?
Paste the query into the GraphQL Query or Mutation box and the minified version appears below at once. Click Copy Minified to copy the single-line result.
Does minifying change what the query returns?
No, as long as the query has no # character or repeated spaces inside string values. Whitespace and comments outside strings are insignificant in GraphQL, so the server parses the minified query the same way.
What happens to a # character inside a string argument?
It is treated as the start of a comment, and the rest of that line is removed. The tool matches text patterns and does not parse strings, so for values like "#ff0000" or "issue #12" pass the value as a variable instead of writing it inline.
Are block strings and descriptions preserved?
Not exactly. Line breaks and repeated spaces inside triple-quoted block strings are collapsed to single spaces. Use the tool for operations, and keep schema files that contain descriptions unminified.
How much smaller does a minified GraphQL query get?
Usually 20 to 50 percent, depending on indentation depth and how many comments it has. The exact figure for your query is shown above the output. Sizes are character counts, which equal bytes for ASCII-only queries.

Rate this tool

Be the first to rate — helps others and improves this page.