GraphQL Formatter

Paste messy or minified GraphQL below, then click Format to beautify it or Minify to compress it. Handles queries, mutations, subscriptions, fragments, variables, and directives — not schema (SDL) files.

More ways to experience Recasely:

Gf

GraphQL Formatter / Minifier

This GraphQL formatter and GraphQL beautifier (or "GraphQL prettifier," if that's the term you're used to) turns a messy or minified query, mutation, subscription, or fragment into clean, properly indented code — or minifies it to cut every unnecessary character for production. It handles nested selection sets, arguments, variables with default values, aliases, directives (@include, @skip), fragment definitions, fragment spreads (...UserFields), inline fragments (... on User { ... }), and comments, which are preserved at their original position unless you check Remove Comments. Output is verified byte-exact against a reference GraphQL formatter's own results. Everything runs in your browser; nothing you paste is ever sent to a server.

When should I minify vs. format my GraphQL?

Format while you're actively writing, debugging, or reviewing a query — consistent indentation and one field per line make nested selection sets far easier to read. Minify only for the payload you actually send over the wire: stripping whitespace and comments shrinks the request size, but a minified query is painful to read or edit, so keep a formatted source copy and minify as a build step, not your working copy.

What happens if I paste invalid GraphQL?

You'll get a clear error message right above the editor explaining what's wrong, with your original text left untouched so you can fix it and try again — not a browser popup that interrupts your workflow and gives you nothing to act on.

Can I format a GraphQL schema (SDL)?

No — this tool formats executable documents (queries, mutations, subscriptions, and fragments), not Schema Definition Language. Pasting a schema file with type, interface, enum, or input definitions will show an error rather than format correctly, since SDL uses a different grammar than the query documents this formatter is built for.

Last reviewed: August 2026