მთავარი მიღებული
- 01Formats queries, mutations, subscriptions, and SDL schemas using the official graphql.js parser.
- 02Validates syntax and reports exact line and column for errors — no schema needed.
- 03GraphQL comments (#) are stripped on formatting; use description strings for documentation you want to preserve.
- 04Runs entirely in your browser — internal API queries and proprietary schemas stay private.
Why Format GraphQL Documents?
GraphQL queries can get complex quickly — nested fragments, inline variables, multiple operation definitions, and SDL type definitions with interfaces and directives. Consistent formatting makes peer review faster and makes it easier to spot missing closing braces or argument mismatches at a glance.
The formatter uses the reference graphql.js parser — the same parser the GraphQL specification ships with. That means the canonical formatting you get here matches what Prettier's GraphQL plugin and most GraphQL tooling produce. Anything that parses cleanly here will parse cleanly in Apollo, Relay, and graphql-request.
How to Format a GraphQL Document
- 01
Paste your GraphQL
Paste a query, mutation, subscription, fragment, or SDL schema definition into the input panel.
- 02
Click Format
The parser emits the document with canonical indentation — two-space indent, one field per line, consistent argument alignment. The result appears in the output panel.
- 03
Validate optionally
Click Validate to confirm the document parses without producing a formatted output. The result is a confirmation or a list of syntax errors with line and column numbers.
- 04
Copy the result
Click Copy to grab the formatted document. Paste it into your codebase, a PR description, or a documentation file.
Safe for Internal Schemas and API Queries
The graphql.js parser runs entirely in your browser. No operation text or schema definition is sent to any server. That makes it safe to format queries that reference private field names or internal type systems you don't want exposed to third-party tools.
Validation here is syntactic only — the tool checks that the document is a valid GraphQL document, but it doesn't check whether field names exist in a real schema, whether variables match argument types, or whether directives are applied correctly. Schema-aware validation requires the target schema to be loaded alongside the document.
GraphQL Formatter FAQ
Does GraphQL formatting validate against a schema?
No — only syntax validation. Checking whether fields and arguments exist requires the target schema. This tool confirms the document is a valid GraphQL document, nothing more.
Will comments in my GraphQL be preserved?
No. Lines starting with # are stripped by the parser. Use triple-quoted description strings for documentation that should survive formatting.
Which GraphQL spec version is supported?
The October 2021 specification, including OneOf input objects and the @specifiedBy directive.
Can I format SDL schema definitions, not just operation documents?
Yes. Type definitions, interface declarations, union types, enums, directives, and descriptions all round-trip correctly through the formatter.
Is the query or schema uploaded anywhere?
No. The graphql.js parser runs entirely in your browser — nothing leaves your device.