Mentigo Icon
MentigoInstrument deck
deck Data & Code Utilities YAML Formatter & Validator
Back to deck
Data & Code Utilities

YAML Formatter & Validator

Format, beautify, and validate YAML in your browser — with dedicated builders and schema checks for OpenAPI specs and GitLab CI (.gitlab-ci.yml) pipelines.

Runs privately in your browser — your input is never uploaded or tracked.

YAML Formatter, Beautifier & Validator Online

Format, beautify, and validate YAML instantly with this free online YAML formatter. Paste any .yaml or .yml file — a Docker Compose stack, Kubernetes manifest, Ansible playbook, GitHub Actions workflow, or app config — and get clean, consistently indented YAML with syntax errors caught and pinpointed before they break your deploy.

YAML is whitespace-sensitive, so a single stray tab, a missing colon, or an inconsistent indent can silently break a pipeline. This validator parses your document the same way a real YAML engine does and reports the exact line and column of any problem, then re-emits the file with the indentation you choose (2 or 4 spaces) while preserving your comments.

Beyond generic YAML, the tool has dedicated modes for two of the most common — and most error-prone — YAML files developers write: OpenAPI API specifications and GitLab CI (.gitlab-ci.yml) pipeline configs. Switch modes to load a ready-made template you can build on, and get structure-aware validation on top of plain syntax checking.

How to Format and Validate YAML

  1. Pick a mode

    Choose Generic YAML, OpenAPI, or GitLab CI depending on the file you are writing.

  2. Paste or build

    Paste your YAML, or click Load Template and use the Add block chips to assemble a spec or pipeline from scratch.

  3. Read the validation

    Syntax errors show the exact line; schema checks flag missing required fields, bad stages, and structural mistakes.

  4. Copy clean YAML

    Copy the re-indented, validated output straight into your repo, manifest, or CI configuration.

Features of the YAML Formatter & Validator

  • Real YAML parsing

    Backed by a full YAML 1.2 engine, so anchors, multi-line strings, and the 'Norway problem' are handled the way your servers see them.

  • Line-accurate errors

    Bad indentation, missing colons, and tab characters are reported with the exact line and column instead of a vague failure.

  • Comment-preserving reformat

    Re-indent to 2 or 4 spaces without stripping the comments that document your config.

  • OpenAPI builder & validator

    Load an OpenAPI 3.x skeleton, add GET/POST paths and auth blocks, and get checks for required info, version, and paths fields.

  • GitLab CI builder & validator

    Start from a build/test/deploy pipeline and catch jobs missing a script or referencing an undeclared stage before you push.

  • Fully client-side

    Configs often hold hostnames, tokens, and internal details — everything is parsed in your browser and never uploaded.

Build and Validate OpenAPI YAML

Switch to OpenAPI mode to write an OpenAPI (formerly Swagger) 3.x specification in YAML. Load Template drops in a valid starting point — openapi version, an info block with title and version, a server, one /users path, and a reusable component schema — so you are editing a working spec instead of a blank file. The Add block chips insert ready-made GET, POST, and path-parameter operations plus a bearer-auth security scheme, which is the fastest way to grow an API definition by hand.

As you type, the validator checks the parts that most often break tooling like Swagger UI, Redoc, and code generators: a present openapi: 3.x version field, a required info object with title and version, and a paths mapping whose keys all begin with a forward slash. It also detects a Swagger 2.0 document and warns you that this validator targets OpenAPI 3.x. Fix the flagged issues and your YAML will import cleanly into the OpenAPI ecosystem.

Build and Validate GitLab CI YAML (.gitlab-ci.yml)

GitLab CI mode is built for the .gitlab-ci.yml file that drives your pipeline. Load Template gives you a complete build → test → deploy pipeline with stages, a variables block, Docker images, artifacts, and branch rules — a realistic starting point you can trim to fit. The Add block chips append a new job, a rules block, a cache definition, or a services block, so assembling a pipeline is a matter of clicking and editing rather than remembering exact YAML shapes.

Validation goes beyond syntax to catch the pipeline mistakes GitLab would only surface after a push: a job that has no script, trigger, or extends and would be rejected, or a job whose stage is not listed in the top-level stages array so it never runs where you expect. Reserved keywords like variables, workflow, include, and default are recognized as configuration rather than jobs, so they are never mistaken for broken jobs. Get a green check here before you commit and you save a round-trip through a failed pipeline.

Frequently Asked Questions

What is a YAML file?

A YAML file (.yaml or .yml) is a human-readable data format used for configuration — Docker Compose, Kubernetes, CI/CD pipelines, and API specs all use it. It represents the same data as JSON but with indentation instead of braces, and it supports comments.

Why is my YAML invalid?

The most common causes are indentation with tabs instead of spaces, inconsistent indent levels, a missing colon or space after a key, or an unquoted string that contains a special character like a colon. Paste your YAML here and the validator points at the exact line so you can fix it fast.

Is .yaml or .yml correct?

Both are valid and identical in content. The official recommendation is .yaml, but many tools historically used .yml (Docker Compose, some CI systems), so you will see both. This tool validates either the same way.

Can I validate an OpenAPI spec here?

Yes. Switch to OpenAPI mode and the tool checks for the required openapi version, info.title, info.version, and a well-formed paths object, on top of validating the YAML syntax itself — the checks that matter for importing into Swagger UI, Redoc, or a code generator.

Will this catch errors in my .gitlab-ci.yml?

It catches structural mistakes GitLab CI would otherwise only report after a push — jobs with no script, and jobs pointing at a stage that isn't declared in the stages list — plus any underlying YAML syntax error. It is a fast pre-commit sanity check, though the GitLab server remains the source of truth for advanced features.

Does formatting change my data or comments?

No. Reformatting only normalizes indentation and spacing; your keys, values, and comments are preserved. It is the same document, just consistently indented to 2 or 4 spaces.