FormatCodes
Home/API Tools/GraphQL Formatter

GraphQL Formatter

Format and validate GraphQL schemas and queries online for free with Prettier's parser.

Local browser processing
No sign-up required
Supports schema & queries
Language
GraphQLschema.graphql
Indent
Line width
Quick format
InputEditable
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
OutputGraphQL valid42 lines · 800 B
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
type User {
id: ID!
name: String!
email: String!
role: UserRole!
posts: [Post!]!
createdAt: DateTime!
}
enum UserRole {
ADMIN
EDITOR
VIEWER
}
type Post {
id: ID!
title: String!
content: String
published: Boolean!
author: User!
tags: [String!]!
}
type Query {
user(id: ID!): User
users(role: UserRole, limit: Int = 20, offset: Int = 0): [User!]!
post(id: ID!): Post
posts(published: Boolean, authorId: ID): [Post!]!
}
type Mutation {
createUser(name: String!, email: String!, role: UserRole = VIEWER): User!
updateUser(id: ID!, name: String, email: String): User!
deleteUser(id: ID!): Boolean!
createPost(title: String!, content: String, authorId: ID!): Post!
publishPost(id: ID!): Post!
}
type Subscription {
postPublished(authorId: ID): Post!
}
UTF-8 · Indent: 2 spaces · Line width: 80Local processing · Ready
How It WorksGraphQL
Overview
This GraphQL formatter cleans up code with inconsistent indentation or mixed styles into a consistent format, powered by Prettier's official GraphQL parser. It correctly recognizes both schema definitions (type, interface, enum, input, union) and operation documents (query, mutation, subscription, fragment). Everything runs locally in your browser; your code never leaves your device.
Use Cases
Format schema definition filesClean up queries and fragmentsValidate whether GraphQL syntax is correctFormat GraphQL code generated by AI or copied from docs
Steps
123
Paste or uploadAdjust format optionsGet the result

Related Tools

Related Guides

Frequently Asked Questions

Search Tools

Search 55+ formatting, conversion, minification, diffing, and generation tools