HTML comments

An HTML comment is a note in the source code that browsers do not render as page content. It starts with <!-- and ends with -->.

What you will learn

Basic syntax

<!-- This note is visible in the source, not in the rendered page. -->

Anything between the opening and closing markers is treated as a comment. It does not create a visible paragraph, heading, or other page element.

Useful purposes

Comments are not private

Visitors can view the HTML source and browser developer tools. Never put passwords, API keys, personal data, or security decisions in a comment. If a block should not be delivered to users, remove it during the build or keep it on the server instead.

Related pages