GraphQL Query Formatter
Pretty-print GraphQL queries with correct indentation based on brace nesting, making queries and mutations easy to read.
About this tool
Pretty-print GraphQL queries with correct indentation based on brace nesting, making queries and mutations easy to read.
Example
Input: { user { id name } }
Output: {
user {
id name
}
}
Privacy
This tool runs entirely in your browser. Your data is processed locally and never uploaded to a server.
How to use this tool
- Paste your GraphQL query or mutation into the input box.
- Click the format button to pretty-print the text.
- Review the indentation and spacing that the tool applies around braces and nested fields.
- Copy the formatted result back into your editor or API client.
Step by step, what happens
- The tool reads the GraphQL text and looks for braces, field lists, arguments, and nested blocks.
- It rewrites the query with consistent indentation so each nested level is easier to follow.
- It keeps the GraphQL structure the same while cleaning up messy spacing and line breaks.
- You can then use the formatted output to spot missing braces or awkward nesting more quickly.
Worked example
Here is a simple query that is hard to read when it is all on one line.
Input: query GetUser { user { id name profile { bio } } }
- The tool detects the top-level query and the nested user and profile blocks.
- It splits the fields onto separate lines and indents each nested block under its parent.
- It preserves the original GraphQL meaning while making the structure clear.
Output: query GetUser {
user {
id
name
profile {
bio
}
}
}
Tips and common mistakes
- Paste valid GraphQL whenever possible, since formatting cannot fix a query with broken syntax.
- If a block looks wrong after formatting, check for a missing or extra brace in the original text.
- Use the formatter before sharing queries with teammates so nested fields are easier to review.
- Formatting is especially helpful for long mutations, where arguments and nested input objects can be hard to scan.
Frequently asked questions
What does it format?
GraphQL queries and mutations, indenting each nested selection set.
Does it validate the schema?
No, it formats text; it does not check fields against a schema.
Is it private?
Yes, formatting runs locally.
More Developer Tools Tools
Explore related calculators in this category
CSV Formatter
Format CSV into a clean, aligned table view for easy reading. Free online CSV formatter.
GraphQL Query Builder
Wrap a GraphQL query into a valid JSON request body and a cURL command for your endpoint.
JSON Formatter
Format, beautify and validate JSON with proper indentation. Shows clear error messages for invalid JSON.
Phone Number Formatter
Format and normalize phone numbers, including US (XXX) XXX-XXXX and E.164 formats.
You Might Also Like
Popular tools from other categories
SQL Formatter
Format and beautify SQL queries with proper indentation and uppercase keywords for readability.
1031 Exchange Calculator - Free Online
Free Calculate tax deferral in a 1031 exchange. Step-by-step solutions and formulas included. Fast, accurate, and free, with formula and example.
4% Rule Calculator
Find the retirement nest egg you need using the 4% safe-withdrawal rule.
70% Rule Calculator
Calculate max offer using the 70% rule for flips.
Can't Find the Right Calculator?
Try our AI Math Solver, type any problem in plain English and get instant step-by-step solutions.