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)
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
- Paste your query into the GraphQL Query or Mutation box.
- Read the before and after size under the Minified GraphQL heading.
- Check that the one-line output still has every field and argument.
- 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.
Related In-Depth Guides
Learn practical workflows, real-world examples, and expert tips in our comprehensive guides:
Password Entropy Explained: How Bits Measure Brute-Force Cracking Time
Understand Shannon entropy in passwords, character pool combinations, and how many seconds, years, or millennia it takes GPUs to crack modern passphrases.
How to Convert Docker Run Commands to Docker Compose YAML Files
A comprehensive developer guide to transforming complex docker run commands into clean, maintainable docker-compose.yml files.
Web Accessibility & Color Contrast (WCAG 2.1): How to Design AA & AAA Palettes
A practical guide to color contrast ratios, accessibility compliance, WCAG 2.1 AA/AAA standards, and building accessible UI palettes.
Rate this tool
Be the first to rate — helps others and improves this page.