GraphQL Query Formatter
Format and prettify GraphQL queries, mutations, subscriptions, and fragments with correct indentation.
How to Use GraphQL Query Formatter
How to Use the GraphQL Query Formatter
Step 1: Paste Your Query
Paste any GraphQL operation into the left textarea. This can be a query, mutation, subscription, or fragment definition. Minified one-liners, partially formatted code, and multi-operation documents are all supported.
Step 2: Choose Indent Size
Use the Indent selector in the top-right corner of the input panel to choose between 2 spaces (default) or 4 spaces. This controls how deeply nested fields and selections are indented in the output.
Step 3: Load an Example (optional)
Click one of the example buttons below the textarea to load a pre-built query:
- Simple Query — a basic query with a field argument
- With Variables — a query using
$variables, a directive (@include), and nested selections - Mutation — a mutation with an input variable
- With Fragments — fragment definitions and spreads across multiple operations
- Subscription — a subscription operation
Step 4: Click Format Query
Click the Format Query button. The formatted output appears in the right panel with correct indentation and each field on its own line.
Step 5: Copy or Download
Use the Copy button to copy the formatted query to your clipboard, or click .graphql to download the result as a formatted.graphql file.
What the Formatter Does
- Places each selected field on its own line
- Indents nested selection sets by the chosen indent size
- Keeps field arguments
(arg: value)inline with the field name - Keeps variable definitions
($id: ID!)inline with the operation name - Formats fragment spreads (
...FragmentName) and inline fragments (... on Type) as separate lines - Preserves directives (
@include,@deprecated) inline with their field - Preserves string literals and comments without modification
Limitations
The formatter is a lightweight token-based prettifier, not a full GraphQL parser. It does not validate the query structure or check types. For full GraphQL spec compliance and error checking, use the GraphQL Schema Validator or an official GraphQL library.
Frequently Asked Questions
Most Viewed Tools
Screen Size Converter
Calculate screen width and height from diagonal size and aspect ratio. Convert between inches and centimeters for displays, TVs, and monitors with instant dimension calculations.
Use Tool →Reorder PDF Pages
Drag and drop to rearrange PDF pages in any order. Upload your PDF, preview all pages as thumbnails, drag pages to reorder them, and download the rearranged PDF. Fast, visual, and privacy-focused.
Use Tool →DPI Calculator
Calculate DPI (dots per inch), image dimensions, and print sizes. Convert between pixels and physical dimensions for printing and displays.
Use Tool →Paper Size Converter
Convert between international paper sizes (A4, Letter, Legal) with dimensions in mm, cm, and inches. Compare ISO A/B series and North American paper standards.
Use Tool →Fuel Consumption Converter
Convert between MPG (miles per gallon), L/100km (liters per 100 kilometers), and other fuel efficiency units. Compare car fuel economy across different measurement systems.
Use Tool →CSV Splitter
Split large CSV files into smaller files by number of rows. Process large datasets in manageable chunks instantly.
Use Tool →Product Schema Generator
Generate JSON-LD Product schema markup for SEO. Add product details like name, price, brand, rating, and availability to create structured data for rich search results.
Use Tool →Large Text File Viewer
View and search large text files up to 200MB in your browser. Features virtual scrolling, line numbers, search functionality, and file statistics. Perfect for log files, CSV, JSON, and code files.
Use Tool →Related API & Backend Tools
API Tester
Test HTTP API endpoints directly in your browser. Make GET, POST, PUT, PATCH, and DELETE requests with custom headers and request bodies. View status codes, response headers, and pretty-printed JSON responses — all client-side, no server proxy.
Use Tool →OAuth Token Validator
Validate and inspect OAuth tokens in your browser. Decode JWT access tokens and ID tokens to view claims, scopes, and expiry. Analyse opaque tokens for entropy and format. Free and private.
Use Tool →JWT Token Validator
Decode and validate JWT tokens instantly in your browser. Inspect header and payload claims, check expiry, and verify HMAC signatures (HS256/HS384/HS512). Free and private.
Use Tool →Webhook Validator
Validate and inspect webhook payloads in your browser. Auto-detects GitHub, Stripe, Slack, and Shopify webhooks, extracts event details, and optionally verifies HMAC signatures. Free and private.
Use Tool →JWT Encoder & Signer
Construct and sign JWT tokens locally in your browser. Edit header and payload JSON, choose HS256/HS384/HS512, enter a secret, and generate a signed token instantly. Nothing is uploaded.
Use Tool →JWT Decoder
Decode JWT (JSON Web Token) headers and payloads locally in your browser. View claims, algorithm info, and signature without sending data to any server.
Use Tool →Share Your Feedback
Help us improve this tool by sharing your experience