Skip to main content

GraphQL Formatter & Validator

Format GraphQL queries and schemas and find syntax errors.

GraphQL input

Up to 1 MiB. Your document stays in this browser.

Options

Indentation

Formatted GraphQL

Add a GraphQL document
Paste a query, mutation, fragment or schema, or load an example, then select Format.
Send operations with GraphQL API Tester

Opens the tester empty. Your document is not passed to it. Checks syntax only, not against a schema.

How to use

  1. 1.Paste a document into GraphQL input or load an example.
  2. 2.Adjust Print width, Tab width or Indentation if your project uses other settings, then select Format.
  3. 3.Copy or download the formatted result as a .graphql file.
  4. 4.If the document has a syntax error, fix the reported line and column and select Format again.

GraphQL Formatter & Validator

This tool accepts any GraphQL document: queries, mutations and subscriptions (named or anonymous), fragment definitions and spreads, inline fragments, variables with defaults, directives, and schema definition language such as types, interfaces, unions, enums, input types, scalars, directive definitions, schema definitions and extensions. The document is parsed with the graphql-js reference parser, then printed by Prettier's GraphQL formatter, the same output many editors and CI checks produce. Comments are kept.

Syntax-only validation

Validation checks GraphQL syntax only. It does not load a schema, so it cannot tell whether a field, argument or type exists, or whether an operation would succeed against your API. Formatting the same output again produces identical text.

Formatting options

Print width is Prettier's preferred line length: lines are wrapped when they can be, but long names, strings or descriptions may still exceed it. Tab width sets the indentation size, and Indentation chooses spaces or tab characters. Other Prettier options do not affect GraphQL and are not shown.

Formatter or API Tester?

This formatter never sends requests. To run an operation against a live endpoint, use the GraphQL API Tester; it opens empty, and nothing from this page is passed to it.

Privacy and limits

Parsing and formatting run entirely in your browser. The document is not uploaded, stored, logged or added to the page address. Documents up to 1 MiB of UTF-8 text are supported.

Frequently asked questions
Does the validator check my document against a schema?
No. It checks GraphQL syntax only. It cannot tell whether a field or type exists in your API.
Which formatter is used?
Prettier's GraphQL printer, with only print width, tab width and tabs or spaces exposed. Formatting its output again gives identical text.
Is my GraphQL document uploaded?
No. Parsing and formatting run in your browser, and the document is not stored or added to the URL.

CodingTool is officially live on