Minify a valid GraphQL query

Web developers use GraphQL Minifier when preparing compact code for delivery or a controlled comparison.

Minify a valid GraphQL query and get compact code ready for the next step. Use it for free in your browser, with no account required.

How to use

  1. Paste a valid GraphQL query into the input area, or import a .graphql or .gql file.
  2. Check the syntax quickly before minifying, because an invalid query will not produce a reliable result.
  3. Run the minifier to get a more compact version of the query.
  4. Compare the output with the original to confirm that fields and arguments are still present.
  5. Clear the field before minifying another query or returning to a readable version.

Example

Before adding a query to a test file or a comparison, a developer minifies it to reduce visible whitespace. They then reread the result to confirm that selections, variables and arguments have stayed the same.

Limits and formats

Where processing happens

Minification happens entirely in your browser. The text you import or paste does not go to a remote service and is not kept after the operation. You can compact a test or project query without an account.

Frequently asked questions

Does minification change the meaning of the query?

Correct minification mainly reduces formatting to produce a more compact version. It should not alter fields, arguments or variables, but always reread the output before using it.

Can I minify an incomplete query?

It is better to start from a valid GraphQL query. Incomplete syntax can give a misleading or unusable result, because the tool does not fix structural errors for you.

Why keep a non-minified version?

The formatted version is easier to read for reviews, debugging and edits. The minified version is better for getting compact text for delivery or a controlled comparison.

Tools in the same category