Skip to content
AgileLogics

YAML Editor

Write and edit YAML with syntax highlighting, right in your browser.

Loading editor…

What YAML is used for

YAML is a plain-text data format built around indentation, used mainly for configuration. Docker Compose files, Kubernetes manifests, GitHub Actions and GitLab CI pipelines, Ansible playbooks, OpenAPI specs and the front matter at the top of static-site pages are all written in YAML. It describes the same maps, lists and scalars as JSON, with less punctuation and support for comments.

This page gives you a browser editor for that kind of file. You get syntax highlighting, find and replace, word wrap, a light or dark theme, fullscreen, copy, and a download button that saves config.yaml. Tab inserts indentation and line numbers run down the left, which helps when an error message points at "line 14, column 5".

What it doesn't do: it doesn't parse or validate the document, and there's no formatter. A file can be highlighted nicely and still fail to load, so test it with the program that will read it.

A Docker Compose file to try

Paste this in. It shows nested mappings, block sequences, a comment, quoted strings and a folded block scalar:

# compose.yaml: a small web app with a reverse proxy
services:
  web:
    image: nginx:1.27-alpine
    ports:
      - "8080:80"
    volumes:
      - ./site:/usr/share/nginx/html:ro
    depends_on:
      - api

  api:
    build: ./api
    environment:
      APP_ENV: production
      ENABLE_CACHE: "yes"
    command: >
      gunicorn app:server
      --bind 0.0.0.0:8000
      --workers 2

The > folds the three command lines into one line separated by spaces, keeping a single trailing newline. Use | instead when line breaks must be kept (a shell script, a certificate), and add - (>-, |-) to drop the final newline.

Gotchas worth knowing

Indentation is spaces only. The YAML 1.2.2 specification says tab characters must not be used for indentation. A tab that sneaks in from another editor is one of the most common causes of "found character that cannot start any token".

Booleans depend on the YAML version. YAML 1.1 had a long list of boolean spellings, including yes, no, on and off. That is why country: NO became false in Python projects (the "Norway problem"), and why PyYAML reads the GitHub Actions key on: as True. The YAML 1.2 core schema only resolves true and false, but plenty of parsers still implement 1.1. Quoting "yes" in the example above keeps it a string everywhere.

Colons and hashes inside values. title: Note: read this fails, because : starts a new mapping. # starts a comment, so color: #fff gives an empty value in most parsers. Wrap such values in quotes. Single quotes are literal (write '' for a quote character), and double quotes allow escapes like \n.

Numbers that look like times. YAML 1.1 parses unquoted 22:22 as a base-60 number. The Docker Compose documentation recommends quoting port mappings for exactly this reason.

Checking the file locally

  1. Click Download and rename the file to whatever your tool expects, for example compose.yaml.
  2. Run the tool's own check where it has one: docker compose config prints the resolved Compose file or the parse error, and kubectl apply --dry-run=client -f file.yaml does the same for Kubernetes.
  3. For a general lint, install yamllint with pip install yamllint and run yamllint file.yaml. It catches tabs, duplicate keys, trailing spaces and the truthy values above.

Related editors and tools

YAML and JSON describe the same data, so the JSON editor is handy when an API wants JSON instead. The JSON validator and JSON formatter help once you've converted. For XML-based config, use the XML editor, or browse every language on the online code editors page.

Last updated

Frequently asked questions

Does this editor validate my YAML?
No. It colours keys, values, comments and block markers so mistakes are easier to spot, but it doesn't parse the document or report errors. To check a file, load it with the parser your tool uses, or run yamllint on it.
Can I use tabs to indent YAML?
No. The YAML specification forbids tab characters in indentation, so indent with spaces only. Two spaces per level is the most common convention in Kubernetes, Docker Compose and GitHub Actions files.
Why did my value NO turn into false?
That is YAML 1.1 behaviour. YAML 1.1 treats yes, no, on, off, y and n as booleans, and parsers such as PyYAML still follow 1.1. YAML 1.2's core schema only recognises true and false. Quote the value ("NO") to keep it a string under any parser.
Is my file saved or sent anywhere?
No. The text stays in your browser tab and isn't uploaded or stored. Copy it or use Download, which saves it as config.yaml, before you close the page.
What is the difference between .yaml and .yml?
Nothing for the content. Both extensions are used for the same format; the YAML project recommends .yaml, and this editor downloads with that extension. Some tools look for one specific filename, such as compose.yaml or .github/workflows/*.yml, so rename to match.