HTML5ANDCSS3 logoHTML5ANDCSS3Tools and Tutorials
  • Insights
  • Verify Certificate
HTML5ANDCSS3 logoHTML5ANDCSS3Tools and Tutorials
HTML5ANDCSS3 logoHTML5ANDCSS3Tools and Tutorials

HTML5andCSS3.org helps developers learn modern frontend skills with practical tutorials, production-ready snippets, and fast web tools built for everyday coding.

Quick Links

  • About Us
  • Contact Us
  • Privacy Policy
  • Copyright
  • Disclaimer

Top Tools

  • Try It Editor
  • JSON Formatter
  • CSS Minifier
  • HTML Minifier
  • Base64 Encoder / Decoder

Contact

  • business@html5andcss3.org
Newsletter

Learn at your own pace, practice with useful tools, and build websites you're proud of.

© 2011-2026 html5andcss3.org. All rights reserved.

How to Use

HTML Tutorial

HTML Basics

Introduction to HTMLHTML EditorsHTML StructureHTML Elements & AttributesHTML HeadingsHTML ParagraphsHTML FormattingHTML CommentsHTML Styles

HTML Text and Links

HTML Text FormattingHTML Quotations & CitationsHTML LinksHTML Email Links

HTML Lists and Tables

HTML ListsHTML TablesTable Styling & Borders

HTML Images and Media

HTML ImagesHTML Picture ElementHTML AudioHTML VideoHTML Embed & Object

HTML Forms

HTML Forms OverviewHTML Form ElementsHTML Input TypesHTML Input AttributesHTML Form AttributesHTML Form Validation

HTML Layout

HTML Block vs Inline ElementsHTML Div & SpanHTML Semantic Layout TagsHTML Iframes

Advanced HTML

HTML Entities & SymbolsHTML EmojisHTML Head Element TagsHTML Meta Tags for SEOHTML Responsive Design

HTML References

HTML5 New TagsDeprecated TagsHTML Global AttributesEvent AttributesComplete HTML Tag ListComplete HTML5 ElementsHTML Tutorial PDF
  1. Home
  2. /
  3. Tutorials
  4. /
  5. HTML Tutorial
  6. /
  7. HTML Comments

HTML Basics

HTML Comments

Comments in HTML are notes or explanations added to your code for yourself or other developers.
They do not appear on the webpage, but are visible in the HTML source code. Comments make your code easier to understand and maintain.

What Is an HTML Comment?

An HTML comment is written using the following syntax:

Comment Example

html

<!-- This is a comment -->
  • Everything between <!-- and --> is ignored by the browser.
  • You can write single-line or multi-line comments.

Single-Line Comment Example

Single-line Comment

html

<p>This is a paragraph.</p>
<!-- This paragraph explains something important -->
  • The <p> text is visible on the webpage.
  • The comment is ignored and not displayed.

Multi-Line Comment Example

Multi-line Comment

html

<!--
This is a multi-line comment.
You can write explanations,
notes, or reminders here.
-->
<p>HTML comments are helpful for developers.</p>

Common Uses of HTML Comments

Code Documentation

Explain sections of code for yourself or other developers.

Debugging

Temporarily disable a part of your HTML code:

Example

html

<!-- <p>This paragraph is temporarily hidden.</p> -->

Organizing Code

Separate sections for better readability:

Organizing Example

html

<!-- Header Section -->
<header>...</header>

<!-- Navigation Section -->
<nav>...</nav>

Important Notes

  • Comments cannot be nested. Don’t put <!-- --> inside another comment.
  • Avoid overusing comments - only use them where necessary for clarity.
  • Comments are visible in the browser’s “View Page Source”, so don’t include sensitive information.

Browser Support

Chrome
Edge
Firefox
Safari
Opera
IE9+
YesYesYesYesYesYes

Conclusion

HTML comments are an essential tool for code documentation, organization, and debugging.
They help developers understand, maintain, and collaborate on projects without affecting what users see on the webpage.

PreviousHTML FormattingNextHTML Styles