Format a minified query
query{user(id:"1"){name email posts{title body}}}query {
user (id:"1") {
name email posts {
title body
}
}
}Format and minify GraphQL queries, mutations, and SDL schemas in your browser. No external library needed.
Loading interactive tool…
The GraphQL Formatter re-indents and minifies GraphQL queries, mutations, subscriptions, fragments and SDL schemas with a small hand-written formatter that runs in your browser; no GraphQL.js library is loaded. Format puts a line break after every opening brace and before every closing brace and indents each nesting level by two spaces. It does not put one field per line: fields inside the same braces stay together on one line, separated by spaces, and argument lists are copied as typed inside their parentheses. Block strings ("""...""") and # comments are kept. Minify removes # comments, collapses whitespace to single spaces and drops the spaces around { } ( ) and :, giving a one-line document for logs or URL parameters. Neither mode parses the document, checks syntax or validates against a schema, so treat Format as a quick re-indent rather than a Prettier replacement.
No GraphQL.js dependency — the formatter is a few dozen lines of plain JavaScript, so nothing extra downloads
Handles queries, mutations, subscriptions, fragments, and SDL in the same tool
Minify mode is useful for pasting queries into URL parameters or logging
Instant client-side processing with no server round-trip
query{user(id:"1"){name email posts{title body}}}query {
user (id:"1") {
name email posts {
title body
}
}
}query GetUser($id: ID!) {
user(id: $id) {
name
}
}query GetUser($id:ID!){user(id:$id){name}}type User {
id: ID!
name: String!
}type User {
id: ID! name: String!
}mutation {
createUser(input: {name: "A"}) {
id
name
}
}mutation{createUser(input:{name:"A"}){id name}}Your shortcut to the everyday. Create, convert, calculate,
and get back to what you love.