HTML Comments

HTML Living Standard

Use comments to leave notes for anyone reading your HTML source.

On this page

HTML Comment Syntax

The browser treats text between <!-- and --> as a comment. Readers can still inspect the page source and see it, so keep secrets out of comments.

How to try it Save this example as a new .html file, then open it in your browser. After a change, save and reload.

<!doctype html>
<html lang="en">
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <title>HTML Comment Syntax</title>
</head>
<body>
<!-- Update the schedule every Monday. -->
<p>Today’s schedule</p>
</body>
</html>

What to expect The preview shows Today’s schedule. Remove the comment markers and run again to display the note too.

Official references