$devtoolkit.sh/tools/graphql-minifier

GraphQL Minifier

Minify GraphQL queries by removing comments and collapsing whitespace.

$graphql input
0 chars1 lines
$minified[READY]
0 chars1 lines

Related Tools

FAQ

Is the minified output semantically identical to the original?
Yes. GraphQL parsers treat whitespace and comments as insignificant. Removing them produces a document that is parsed identically by any compliant GraphQL server.
Are inline string values affected?
String literals (wrapped in double quotes or block strings with triple quotes) are preserved exactly, including internal whitespace. Only whitespace outside of string literals is collapsed.
When would I want to minify a GraphQL query?
Minified queries are useful when embedding GraphQL in HTTP request bodies to reduce payload size, in persisted query IDs, or when storing queries in source code as single-line template literals.

GraphQL Minifier strips all comments (# line comments), collapses consecutive whitespace into single spaces, removes newlines, and trims the result — producing a compact single-line GraphQL query suitable for embedding in network requests or source code. Structural tokens like { } ( ) , : are preserved exactly. All processing happens in your browser.

/tools/graphql-minifierv1.0.0