Yoryantra
← Back to Tools

GraphQL Query Formatter

Format, minify, and inspect GraphQL queries, mutations, subscriptions, fragments, variables, operation names, and request payloads directly in your browser.

Paste a query, mutation, subscription, fragment, or copied request body query string.

Query editorLocal only

Request Context

Optional values used when generating request payloads or cURL output.

Leave empty when the query does not need variables.

Used only for cURL output. The placeholder is not sent unless you generate a cURL example without an endpoint.

Options

The formatter is designed for practical readability and request debugging. It does not execute your query.

Output

Formatted GraphQL output will appear here.
This tool formats and inspects GraphQL text locally. It does not validate against a schema or send requests to your endpoint.

Formatting GraphQL Queries for Easier API Debugging

GraphQL requests can become hard to read when copied from logs, browser DevTools, API clients, or minified production traffic. Formatting the query makes fields, nested selections, variables, fragments, and operation names easier to review.

This GraphQL Query Formatter formats and minifies queries, extracts operations and variables, formats variables JSON, and generates request payloads or cURL commands for debugging.

Using the GraphQL Query Formatter

  1. Paste a GraphQL query, mutation, subscription, or fragment.
  2. Optionally paste Variables JSON and an endpoint URL.
  3. Choose formatted, minified, summary, JSON payload, cURL, or variables output.
  4. Review operation names, fragments, variables, and warnings.
  5. Copy the output for testing, documentation, or debugging.

Common GraphQL Formatting Tasks

  • Beautify a minified GraphQL query from logs.
  • Minify a query before embedding it in a request payload.
  • Extract operation names from a copied GraphQL document.
  • Check whether variables used in the query are documented in Variables JSON.
  • Create a cURL request for quick API testing.
  • Review fragments before sharing a query with another developer.

Example GraphQL Query

query GetUser($id: ID!) {
  user(id: $id) {
    id
    name
    email
  }
}

Formatting Is Not Schema Validation

A formatter can make a query easier to read, but it cannot know whether fields, arguments, enum values, or variable types are valid unless it has your GraphQL schema.

Use this tool for readability and request debugging, then use your GraphQL server, schema tooling, or API client for schema-level validation.

Frequently Asked Questions

What does a GraphQL Query Formatter do?

It formats and minifies GraphQL queries and extracts useful details such as operations, fragments, and variables.

Does this validate my GraphQL schema?

No. It formats and inspects query text but does not validate fields or types against a schema.

Can it format GraphQL variables?

Yes. Paste Variables JSON and choose the formatted variables output or JSON request payload.

Can it generate a cURL request?

Yes. Add a GraphQL endpoint and choose cURL output.

Is anything uploaded when I format GraphQL?

No. Formatting runs directly in your browser.