GraphQL formatter + minifier — beautify query/mutation/subscription/schema, validate syntax, copy minified single-line for HTTP body.
- Runs locally
- Category Developer & DevOps
- Best for Formatting, validating, shrinking, or inspecting code-adjacent text.
Formatted output appears here.What this tool does
A focused GraphQL formatter that runs entirely in your browser. Pretty-print queries, mutations, subscriptions, fragments, and full SDL schemas (type, interface, union, enum, input, scalar, schema, extend). Choose your indent (2 spaces, 4 spaces, tab), keep or strip comments, sort fields and arguments alphabetically, then copy. Switch to minify mode and the same input collapses to a single line — drop it straight into a `curl -d`, `fetch` body, or HTTP client without escape-newline gymnastics. Errors arrive with exact line + column and three lines of source context, so "Unexpected }" finally has an address. Variables in the query are enumerated below the output ($id: ID! → ID! required). 100% client-side, no spec library, no network round-trip, safe for production queries.
Tool details
- Input
- Files + Text
- The page exposes text boxes, numeric controls, file pickers, or structured inputs depending on the tool.
- Output
- Live result + Copy + Download
- The result area focuses on usable output, with copy, download, or preview actions when supported.
- Privacy
- Browser-side processing
- The main tool logic does not call an external API, so inputs normally stay in the current tab.
- Save / share
- Shareable URL state
- Key settings are encoded in the URL so another person can reopen the same setup.
- Performance budget
- Initial JS <= 35 KB
- No WASM budget is declared, keeping the tool quick to open on mobile.
- Best fit
- Developer & DevOps · Developer
- Category and role tags drive related tools, internal links, and quick fit checks.
How to use
-
1. Input
Paste or drop your content into the tool panel.
-
2. Process
Click the button. All processing is local in your browser.
-
3. Copy / Download
Copy the result or download to disk in one click.
How GraphQL Formatter & Minifier fits into your work
Use it in the small gaps between coding, reviewing, debugging, and shipping.
Developer jobs
- Formatting, validating, shrinking, or inspecting code-adjacent text.
- Preparing snippets for documentation, tickets, commits, or handoff.
- Checking a small payload quickly without switching tools.
Developer checks
- Run irreversible transforms like minify or obfuscate on a copy.
- Keep secrets out of pasted snippets unless the tool explicitly stays local.
- Use your normal tests or linter before shipping transformed code.
Good next steps
These links move the current task into a more complete workflow.
- 1 JSONPath / JMESPath Query Tester JSONPath / JMESPath query tester — paste JSON, write a path, see matched values + matched paths highlighted live. Open
- 2 JSON Formatter & Validator Format, validate, and minify JSON instantly — right in your browser. Open
- 3 SQL Formatter Format and beautify SQL — supports MySQL, PostgreSQL, BigQuery, SQLite and 17 more dialects. Open
Real-world use cases
Format a one-line query pasted from a webhook payload
You captured a webhook payload and the GraphQL field inside it is a single 1.4 KB line — totally unreadable. Paste, hit Format, you get a multi-line operation with one field per line, 2-space indent, and the variables panel below shows the `$cursor: String` / `$limit: Int = 20` you need to call it. Three seconds, no Node REPL, no installing `graphql` from npm to run `print(parse(x))`.
Strip an Apollo query down for an HTTP request body
Your Apollo query lives in a `.graphql` file with comments, blank lines, and 80 lines of layout. You want to POST it raw via curl for a one-off cron job. Paste, hit Minify, copy. Output is a single line, comments removed (they would corrupt the line), ready to drop into `curl -d '{"query":"..."}'` without any newline-escape dance.
Sanity-check a hand-edited SDL before pushing the schema
You added a new `interface` and three `type`s to your SDL by hand. Paste the whole file, the parser tells you exactly where the stray `:` is (line 47, column 19, with the surrounding 3 lines shown). Fix, re-paste, "Valid GraphQL" badge appears. Now your `graphql-codegen` step will not fail in CI with a vague "unknown token at offset 1284".
Diff two long queries by sorting fields and arguments
QA sent you a query that "should be the same as the one in main" but a snapshot test diff shows 60 changed lines. Format both queries with sort-fields + sort-arguments on, paste each into a diff viewer — now the noise from author reordering is gone and the one real semantic change (a missing `id` field on the `User` type) jumps out.
Convert a printed schema to a readable spec doc
You pulled the printed schema from your gateway (one giant blob). Paste, Format with 4-space indent and "keep comments" on, copy the result into your team wiki. Definitions are grouped by declaration, comments stay on their original lines, and the variables panel ignores SDL (no $vars in SDL) so the output is clean documentation, not a tool dump.
Common pitfalls
Pasting a JSON wrapper like `{"query": "..."}` — the formatter expects raw GraphQL, not the wire format. Extract the value of the `query` key first; you can use the JSON Formatter tool to find it.
Expecting the formatter to validate field types against your schema. This tool only checks GraphQL syntax — server-side resolvers, deprecated fields, and unknown selections are NOT flagged. Use codegen or a real introspection client for schema-aware checks.
Forgetting that the `#` comment runs to end-of-line. If you write `field # note` and then hit Minify, that whole tail (including subsequent fields on the same logical line) would be lost, which is why minify removes comments entirely instead.
Privacy
Your GraphQL is parsed by a hand-written ~400-line parser that lives in this page bundle — no `graphql-js`, no network, no remote schema fetch. Open DevTools → Network while formatting and you will see zero outbound requests carrying your query. The URL only ever syncs the option choices (indent, sort flags, mode). The query body itself is never written to the URL because production queries often reference internal field names you would not want in a shared link. Safe to paste real operations with PII argument values, internal IDs, or auth context.
FAQ
Tool combos
Folks in your role tend to reach for these alongside this tool.
- Add Line Numbers Number every line of pasted text — set start, step and separator, zero-pad to align, skip blanks, or strip numbers back off — browser-only
- AES Text Encryptor Encrypt & decrypt text with a password — AES-256-GCM + PBKDF2 via WebCrypto — 100% in your browser, nothing uploaded
- Affine Cipher Encoder & Decoder Encrypt and decrypt the ax+b affine cipher with live modular-inverse check, browser-only
- Age Difference Calculator The exact gap between two birthdays — years/months/days, percentage, and the date one person is twice the other's age — browser-only