Format OpenAPI

Format an OpenAPI document with stable indentation and readable nested schemas.

freeworks offlinenothing uploaded
ToolOpenAPI Formatter
Input
Output
Put this on your own site

The frame below runs the same code as this page, in the reader's own browser. Nothing is sent to us, and nothing is sent to you.

Pick a dark background and the text and panels follow it, so the frame stays readable on a dark page.

Preview

How it works

The document is parsed into paths, operations, components, schemas, and security objects, then serialized with stable indentation and key ordering. References and descriptions remain intact; formatting does not validate or resolve the contract.

  • Stable ordering reduces review noise.
  • Indentation exposes nested response structures.

Worked example

Format Minified OpenAPI Spec
Pretty-print a minified OpenAPI 3.0 spec with proper indentation
Input
											{"openapi":"3.0.3","info":{"title":"Pet Store","version":"1.0.0"},"paths":{"/pets":{"get":{"summary":"List pets","responses":{"200":{"description":"OK"}}}}}}
										
Output
												{
  "openapi": "3.0.3",
  "info": {
    "title": "Pet Store",
    "version": "1.0.0"
  },
  "paths": {
    "/pets": {
      "get": {
        "summary": "List pets",
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    }
  }
}
											

When to use this

API pull requests, documentation builds, and gateway repositories format specs.

Edge cases

  • YAML anchors may not map to OpenAPI references.
  • Key ordering can change text without changing meaning.
  • An invalid $ref remains invalid after formatting.

References