How to add comments in Markdown
Markdown has no native comment syntax. The standard workaround is an HTML comment — <!-- … --> — which most Markdown renderers leave out of the final output.
HTML comments
Anything between the markers is ignored when rendered, and works for single or multiple lines:
<!-- This is a comment. It won't appear in the rendered output. --> Visible text here. <!-- Comments can span multiple lines. -->
<!-- This is a comment. It won't appear in the rendered output. -->
Visible text here.
<!-- Comments can span multiple lines. -->Important gotchas
- The comment is hidden in the rendered page, but it's still present in the raw
.mdfile — never put secrets in it. - A few strict renderers may still display HTML comments; test in your target tool. (Our live editor hides them, as GitHub does.)
- Put a blank line before and after a block comment to avoid it merging with nearby text.
Related: cheat sheet · code blocks.
Have a document instead of text?
Convert PDFs, Word, PowerPoint, Excel, and images into clean Markdown — free, no signup.
Convert a file to Markdown →