Boneyard Tools

GraphQL Formatter and Minifier

Paste a GraphQL query, mutation, subscription or schema to format it into clean, indented lines with one selection per line, or minify it down to the smallest valid string. Strings and comments are preserved, and everything runs in your browser.

How to format GraphQL

  1. Paste your GraphQL query, mutation or schema into the editor.
  2. Choose Format for readable indentation or Minify to strip whitespace, and pick an indent size.
  3. Copy the result or download it as a .graphql file.

Examples

Format a query

{user(id:1){name email}}
{
  user(id: 1) {
    name
    email
  }
}

Minify a query

{
  user(id: 1) {
    name
    email
  }
}
{user(id:1){name email}}

Format a schema type

type User{id:ID! name:String email:String}
type User {
  id: ID!
  name: String
  email: String
}

Frequently asked questions

What does the GraphQL formatter do?

It rewrites a document with consistent indentation and line breaks. Each selection, argument list and schema field is normalized: indentation grows after an opening brace and shrinks before a closing one, every field sits on its own line, and spacing around colons, arguments and directives is tidied. Keywords and field names keep their original casing.

Does it work on queries, mutations and schemas (SDL)?

Yes. It handles queries, mutations and subscriptions, including variables, aliases, fragments, inline fragments and directives, as well as Schema Definition Language such as type, interface, input, enum, union and scalar definitions. List types, non-null markers and default values are formatted cleanly.

What does minify do?

Minify removes every piece of insignificant whitespace and drops standalone comments, keeping a single space only where two tokens would otherwise merge into one. The result is the smallest valid form of your document, which is handy for embedding a query in code or shrinking a request payload.

Are my strings and comments left alone?

String values, including block strings wrapped in triple quotes, are preserved character for character, so words that look like fields are never touched. Comments are kept on their own line when formatting. Minify drops comments because they are not part of execution.

Does it validate or run my GraphQL?

No. The formatter only reshapes whitespace and line breaks. It does not check that your document is valid against a schema, connect to any endpoint, or execute anything. Your GraphQL is restructured exactly as written.

Is my GraphQL private?

Yes. Formatting and minifying happen entirely in your browser. Nothing you paste is uploaded, logged or stored on a server.

Related tools