Dev Tools

GraphQL Formatter

Format and prettify GraphQL queries, mutations, subscriptions, type definitions, and fragments. Preserves comments.

GraphQL input
Formatted output
query GetUser($id:  ID!) {
  user(id:  $id) {
    id name email posts(first:  10,  orderBy:  CREATED_AT_DESC) {
      edges {
        node {
          id title...PostDetails
        }
      }
    }
  }
}
# Fragment for post details
fragment PostDetails on Post {
  body createdAt author {
    name
  }
}
mutation CreateUser($input:  CreateUserInput!) {
  createUser(input:  $input) {
    user {
      id name
    }
    errors {
      field message
    }
  }
}
type User {
  id:  ID! name:  String! email:  String posts: [Post!]!
}
Was this page helpful?

Related tools