GraphQL formatter & validator
Format, validate, and minify GraphQL queries and schemas. Free, private — nothing leaves your browser.
Your beautified code will appear here.Related tools
Format JSON
Format, validate, and minify JSON with your choice of indent. Errors show where the problem is. Nothing is uploaded.
Beautify & minify code
Beautify or minify JSON, JavaScript, HTML, CSS, and YAML. Choose your indent, nothing is uploaded.
Format XML
Format, validate, and minify XML with your choice of indent. Errors show the line and column. Nothing is uploaded.
More related tools
Everything you need to work with GraphQL
Format and check in one step
Valid GraphQL is indented. A missing bracket or open string shows the line and column.
Your choice of indent
2 spaces, 4 spaces, or tabs, or minify to the smallest possible size.
Instant, live output
The result updates as you type or paste. No button to click and no page reload.
Queries and schemas, comments kept
Operations, fragments and SDL types all work, and # comments and descriptions stay in place.
Copy or download
Copy the result to your clipboard or save it as a .graphql file.
100% private
Your GraphQL never leaves your browser. Nothing is uploaded, logged, or stored.
Format GraphQL in three steps
- 1
Paste your GraphQL
Paste or type a query, mutation, fragment or schema (SDL) into the input box. It can be one long line copied from a network tab or a half-indented file.
- 2
Check the result
Valid GraphQL appears indented straight away. If a bracket is never closed, a string is left open or a character does not belong, you get an error with the line and column of the first problem.
- 3
Pick an indent, then copy or download
Choose 2 spaces, 4 spaces, or a tab, or switch to Minify for the smallest size. Copy the result or download it as a .graphql file.
Built for everyday developer work
A GraphQL query copied from a network tab or a log is usually one long line, and one missing brace makes the server reject it. Formatting makes it readable, and checking tells you exactly where it is wrong.
Reading a query from the network tab
Paste the one-line query a web app sends and see which fields it asks for.
Cleaning up a schema file
Re-indent a .graphql schema so types, fields and descriptions line up before you commit it.
Finding a syntax slip
Locate the unclosed brace or open string that makes a server reject a query.
Sharing a readable query
Indent a query before pasting it into a ticket, a doc, or a chat message.
Frequently asked questions
What does a GraphQL formatter do?
+
It re-writes a GraphQL query or schema with line breaks and indentation so a person can read it. Field names, arguments, values and comments stay the same. Only the whitespace and the optional commas between items change.
Can it format a schema as well as a query?
+
Yes. Queries, mutations, subscriptions, fragments and schema definition language (type, input, enum, interface, union, scalar, directive and extend) all work, including the descriptions written above types and fields.
Does this also validate my GraphQL?
+
It checks the syntax: brackets and parentheses match and are closed, strings are closed, and no stray characters or malformed numbers are present. It does not check your query against a schema, so an unknown field or a wrong argument type is not reported.
Are my comments kept?
+
Yes. Lines starting with # stay where you put them, either on their own line or at the end of a line. Many formatters built on a parse-and-print step drop them. Descriptions in triple quotes are kept and re-indented.
Why were my commas removed or added?
+
In GraphQL, commas between fields, arguments and list items are optional whitespace. The formatter writes arguments and variables as a, b with a comma and space, and leaves them out between fields on separate lines.
How do I minify GraphQL instead?
+
Switch the toggle from Beautify to Minify. It removes comments, line breaks and optional commas, keeping a space only where two names would otherwise run together. This is useful for a query string sent in a request body.
Is my query uploaded anywhere?
+
No. Formatting runs entirely in your browser with JavaScript. Nothing you paste is sent to a server, logged, or stored, so it is safe to use on queries that contain internal field names or tokens.
Format your GraphQL now
Free, no account needed.