Messy input
query($id:ID!){user(id:$id){id name posts(first:5){title}}}The GraphQL Formatter beautifies queries, mutations, subscriptions, and schema definitions into clean, consistently indented documents. It aligns selection sets, indents nested fields, and normalizes spacing around arguments, directives, and braces so complex operations are easy to scan. Because it works entirely in your browser, your operations and schema, which can reveal internal API shapes, are never uploaded to any server.
GraphQL is a query language and runtime for APIs that lets clients request exactly the fields they need from a typed schema. Operations describe nested selection sets, often with arguments, variables, fragments, and directives, which become hard to read when written on one line. Formatting restores the indentation that mirrors the shape of the requested data, making queries easier to review, share, and debug, and helping teams keep a consistent style across a schema.
The main file is the entry point for each run.
Use the Input panel to pipe standard input to your program when it needs data.
Run sends your code to a fresh hosted runtime and streams the result into the output panel.
Your draft stays in this browser, and Share creates a separate snapshot link.
query($id:ID!){user(id:$id){id name posts(first:5){title}}}query ($id: ID!) {
user(id: $id) {
id
name
posts(first: 5) {
title
}
}
}mutation AddPost($input: PostInput!) {
addPost(input: $input) {
...PostFields
}
}
fragment PostFields on Post {
id
title
}subscription OnComment($postId: ID!) {
commentAdded(postId: $postId) {
id
author
text
}
}type Query{user(id:ID!):User posts:[Post!]!}type User{id:ID!name:String!email:String}type Query {
user(id: ID!): User
posts: [Post!]!
}
type User {
id: ID!
name: String!
email: String
}query ($withEmail: Boolean!) {
primary: user(id: "1") {
name
email @include(if: $withEmail)
}
}query{search(q:"x"){__typename ... on User{name} ... on Post{title}}}query {
search(q: "x") {
__typename
... on User {
name
}
... on Post {
title
}
}
}The editor uses Monaco, the engine behind VS Code, with language-aware editing tools and familiar keyboard controls.
Paste a query, mutation, subscription or schema and it beautifies the document.
Selection sets are aligned and nested fields are indented to mirror the data shape.
Spacing around arguments, directives and braces is normalized.
Handles variables, fragments and directives in complex operations.
Makes single-line operations easy to scan and review.
Keeps a consistent style across queries and schema definitions.
Works entirely in your browser, so operations are never uploaded.
Schema details that reveal internal API shapes stay on your machine.
Copy the formatted operation to share or paste into your client.
Great for tidying ad-hoc queries before saving them.
Output
Start typing to auto-process