GraphQL Formatter
Format and indent GraphQL code into a clean, readable structure directly in your browser.
This tool runs entirely in your browser. Your files are never uploaded to a server.
query User($id:ID!) {
user(id:$id) {
id name email
}
}What this formatter does
Adds line breaks around GraphQL-style braces and after commas, with two-space indentation for nested brace levels. It preserves ordinary quoted text and offers an immediate result that can be copied.
How to use it
Paste a query, mutation, fragment, or schema-like text and inspect the output. Reset clears the editor rather than restoring the sample.
Important limitations
This is a generic brace formatter, not a GraphQL parser, validator, schema checker, or canonical printer. It does not verify fields, variables, directives, types, or balanced syntax. GraphQL # comments are not recognized as comments, so newline collapsing can change what a comment covers; do not use it on documents containing # comments without a careful manual review. Block strings and unusual escapes also need checking.
How the brace scan works
The scanner reacts only to `{`, `}`, and `,` — it does not know that GraphQL uses `#` for comments, so a newline inserted after a comma can shift text that follows a `#` comment onto a different logical line than intended.
Example
Pasting `query{user(id:1){name,email}}` produces `query {` on its own line, an indented `user(id:1) {`, then `name,` and `email` each indented one level further, with matching closing braces at each level.
Safe review workflow
Run the formatted query through your GraphQL client or schema validator before relying on it, and manually re-check any document containing `#` comments since their scope can shift after reformatting.
Privacy
Formatting runs locally in your browser. Queries, schema text, and copied output are not uploaded by this tool.
Frequently Asked Questions
- What does the GraphQL Formatter do?
- Format and indent GraphQL code into a clean, readable structure directly in your browser.
- Does this GraphQL tool change program behavior?
- It only changes layout or removable whitespace. Review minified output before production use when code relies on unusual syntax.
- Is my code uploaded?
- Processing is local and your code is never uploaded.
Related Tools
Markdown Formatter
Format and indent Markdown code into a clean, readable structure directly in your browser.
SCSS Formatter
Format and indent SCSS code into a clean, readable structure directly in your browser.
YAML Formatter
Format and prettify YAML documents instantly in your browser.
CSS Formatter
Format and indent CSS code into a clean, readable structure directly in your browser.
HTML Formatter
Format and indent HTML code into a clean, readable structure directly in your browser.
JavaScript Formatter
Format and indent JavaScript code into a clean, readable structure directly in your browser.