GraphQL Query Formatter and Validator

Parse and format pasted or uploaded GraphQL using the bundled grammar.

On-device No sign-up Free to use

Inspect input controls

Showing an example. Edit to see your own.

Drop your text file here

or choose one from your device

Optional UTF-8 text up to 100,000 bytes. A chosen file replaces pasted text.

    ?

    Up to100,000 bytes. Checks JSON object syntax only; variable types still require the API schema. Nothing is sent.

    Processed in your browser. Your inputs stay on this device.

    Result

    Showing an example.

    Format a named GetUser query while preserving its $id variable and selected fields.

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

    Loading the tool. Your result will appear here.

    https://usefreetools.net/graphql-query-formatter-validator · 20 November 2026

    Was this helpful?

    How to use GraphQL Query Formatter and Validator

    1. Paste a GraphQL document or choose one UTF-8 .graphql, .gql or text file. A selected file replaces the pasted document.
    2. Choose two or four indentation spaces and a preferred line width from 40 to 120. Optionally enter Variables JSON as an object.
    3. Read the formatted document or syntax error, then copy or download formatted-query.graphql. Check fields, argument types and variable values against your intended API schema separately.

    Example: GraphQL Query Formatter and Validator

    Format a named GetUser query while preserving its $id variable and selected fields.

    You add
    GraphQL document: query GetUser($id: ID!) { user(id: $id) { id name } }; Indent spaces: 2; Line width: 80
    You get
    query GetUser($id: ID!) { user(id: $id) { id name } }

    Options

    Document input
    The parser handles GraphQL syntax rather than contacting an endpoint. Pasted source is limited to 100,000 characters; a selected UTF-8 file is limited to 100,000 bytes and replaces the text.
    Indentation and width
    Choose two or four spaces and a whole preferred width from 40 to 120. A formatter’s preferred width is not a strict limit for every string or expression.
    Variables JSON
    Optional, up to 100,000 UTF-8 bytes, and it must be a JSON object. This checks the supplied JSON structure only. It does not check GraphQL variable names, required values or types against a schema, and variables are not sent anywhere.

    Supported inputs and limits

    • GraphQL source up to 100,000 characters, 2,000 scanned tokens and 100 nesting levels.
    • A selected UTF-8 source file is limited to 100,000 bytes.
    • Parsing and formatting use the bundled Prettier GraphQL grammar.
    • Optional variables input is checked as a JSON object, not validated against the operation or API schema.
    • No schema connection, resolver execution, endpoint request, minification or query-cost analysis occurs.

    Where your input is processed

    This tool does not upload your inputs. See the limits for anything saved on your device.

    A parsed query may still fail against a schema

    Syntax can be valid while a field, argument or type is absent from the actual API. This page has no schema and makes no requests. Validate the operation against its intended schema, supply the required variables and review its effects before running it in another system. Formatting does not estimate query cost.

    Questions about GraphQL Query Formatter and Validator

    Does valid syntax prove a query will work?

    No. The server schema and variable values must also match.

    Will the query be sent to an endpoint?

    No. Syntax processing happens in this browser.

    Does formatting execute mutations?

    No. It changes source layout without running any operation.

    Page updated · Project managed by Tony Hines · Report a problem with GraphQL Query Formatter and Validator