Skip to content
gohacks.dev
APIs

GraphQL Formatter

Format a GraphQL query, mutation or fragment with one field per line, or minify it for a GET request, with strings and comments left intact.

Free · No sign-up · Your inputs stay in your browser

Input

Format or minify a GraphQL query

Output

GraphQL

404 characters

A layout pass over the tokens: one field per line, arguments kept on the field's line, strings and block strings untouched. Minifying drops comments and the insignificant commas the spec allows. It checks that braces balance; checking fields against a schema needs the schema.

Runs in this browser. Nothing you paste is sent to a server.

Readable queries, small requests

Queries copied from logs, network panels or code arrive on one line. Formatted, the nesting shows which fields belong to which type. For persisted queries and GET requests, a minified query keeps URLs short. The GraphQL specification treats commas as insignificant, which is why both forms are equivalent.

What it does not check

Formatting reads the syntax, not your schema. A field that does not exist or a wrong argument type is only caught by validating against the schema, which GraphQL servers do before executing, and which GraphiQL and graphql-language-service do in editors.

Share

Frequently asked questions

Are commas required between GraphQL fields?
No. Commas are insignificant in GraphQL and treated like whitespace. Formatters usually omit them between fields and keep them between arguments for readability.
How do I send a minified query in a GET request?
URL-encode it into the query parameter: GET /graphql?query=...&variables=.... Many servers allow GET only for queries, not mutations.
Is what I paste sent anywhere?
No. The tool runs entirely in your browser with JavaScript. Nothing you type or paste is sent to our server or stored.

Keep planning

Similar tools