Remove comments from
YAML code.
Remove comments from YAML config files online. Handles GitHub Actions workflows, Docker Compose files, Kubernetes manifests, and any other .yaml/.yml document.
.yaml filesBefore and after
Real-world YAML code on the left. The same code with every comment removed on the right.
# Deploy workflow
name: Deploy
on:
push:
branches: [main] # only main triggers deploy
env:
APP: my-app # service name
COLOR: "#ff0000" # quoted, not a comment
jobs:
build:
runs-on: ubuntu-latest # default runner
steps:
# Check out the code
- uses: actions/checkout@v4
# Install dependencies
- run: npm ci
# Run tests
- run: npm test
# - run: npm run e2e # disabled for nowname: Deploy
on:
push:
branches: [main]
env:
APP: my-app
COLOR: "#ff0000"
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: npm ci
- run: npm testBuilt for YAML specifically.
YAML files for CI pipelines and infrastructure-as-code accumulate comments fast, explanations, alternative settings, deprecated keys. Removing them shrinks the file, makes diffs easier to read, and produces a clean canonical version of the config. Uncommenter handles YAML's `#` line-comment syntax while keeping every key and value untouched.
- # line comments removed
- String values with `#` preserved (when quoted)
- Indentation and structure preserved exactly
- Multiline strings (| and >) untouched
- Auto-detected from .yaml and .yml files
Strip comments in 30 seconds.
- 1
Open the tool
Head to uncommenter.com/tool. Nothing to install. Nothing to sign up for.
- 2
Paste your YAML code
Drop your .yaml file in, or paste code into the editor. Auto-detection picks up YAML from the extension or file content.
- 3
Click 'Remove Comments'
The parser walks every character with a real state machine, strings, regex, and other context-sensitive parts are detected and left alone.
- 4
Copy or download
Grab the cleaned output. Your code never left your browser.
YAML questions, answered.
What about quoted strings containing #?
+
Quoted strings are preserved. "#ff0000" or 'a #hashtag' inside a value will not be touched.
Will it preserve indentation?
+
Yes, only comment characters and the trailing whitespace on a line are removed. The structural indentation YAML relies on is left intact.
Does it handle multi-line block scalars?
+
Yes. Block scalars introduced by | or > are recognized as multi-line strings, so comment-like content inside them is preserved.
Working in something else?
Plus 35+ more languages supported in the live tool , including HTML, YAML, Dockerfile, Terraform, Solidity, and more.
Try it on your YAML code now.
Free forever. No signup. No upload. Runs entirely in your browser.
Open uncommenter