Remove Comments from YAML

Remove Comments from YAML strips out full-line and inline comments in your YAML files. Paste or upload and clean your content instantly.

Paste your input above or import a file below.
No file chosen
Supported file types: .txt, .yaml, .yml
Total characters: 0
Options
Preserve inline comments
Maximize output

How to Use:

  • Paste YAML into the input box or upload a .txt, .yaml, or .yml file
  • The tool removes comment lines (those starting with #) by default
  • Use the Preserve inline comments toggle to keep # comments that appear after key-value pairs
  • Turn it off to remove all comments entirely, including inline ones
  • Output updates live as you type or modify the toggles
  • Click Copy Output to copy the cleaned YAML to your clipboard
  • Click Export to File to save the cleaned version as a .yaml file
  • Use the Maximize output toggle to make the output box larger
  • Click Clear All to reset everything input, output, options, and file info

What Remove Comments from YAML can do:

This tool cleans up your YAML by getting rid of those extra notes and comment lines you don’t want either all of them or just the full-line ones. It works great when you need to sanitize a file before sending it, clean it up for parsing, or reduce clutter for readability. Inline comments after a field (like name: Alice # user name) can be preserved if needed. Everything runs locally in your browser, so your YAML never leaves your machine. And because the preview is instant, you can toggle, paste, and clean up in seconds.

Example:

Input:

# This is a comment
name: Alice # user's name
age: 30
# End of block

Output (Preserve inline off):

name: Alice
age: 30

Common Use Cases:

Use this when prepping YAML for automation or APIs, or when sharing files with teams where comments shouldn’t be visible. It’s also helpful when simplifying complex configs or cleaning up versioned files before comparison.

Useful Tools & Suggestions:

Before stripping out comments, it might help to Extract Comments from YAML first in case you want to save them somewhere. And once you’ve cleaned things up, Prettify YAML can tidy the structure so it’s easier to work with.