HTML5

Are HTML5 Tags Case Sensitive?

A common interview question is whether HTML5 tags are case sensitive. The short answer: HTML5 tag names and attribute names are NOT case sensitive — the browser treats <DIV>, <Div>, and <div> the same. However, writing everything in lowercase is the widely recommended convention.


Are Tags Case Sensitive?

No. In HTML5, element (tag) names and attribute names are case-insensitive. The parser normalizes them internally, so <SECTION>, <Section>, and <section> all produce the same element. The same applies to attribute names like HREF, Href, and href.

All of these are treated identically by the browser
<A HREF="page.html">Link</A>
<a Href="page.html">Link</a>
<a href="page.html">Link</a>

Why Lowercase Is the Best Practice

  • The W3C and WHATWG style guides recommend lowercase for readability and consistency.
  • XHTML (an XML-based syntax) requires lowercase — using it keeps your code portable.
  • Lowercase is easier to type, read, and maintain across a team.

What IS Case Sensitive?

While tag and attribute names are case-insensitive, some values are case sensitive. Attribute VALUES such as id and class references, file paths/URLs (on case-sensitive servers), and JavaScript identifiers must match exactly.

Attribute values ARE case sensitive
<!-- These two IDs are DIFFERENT -->
<div id="MainMenu"></div>
<div id="mainmenu"></div>

<!-- CSS selector must match the exact case -->
<style> #MainMenu { color: red; } </style>
ℹ️

Rule of thumb: tag and attribute NAMES are case-insensitive; attribute VALUES, IDs, class names, URLs, and JavaScript are case-sensitive. Always write tags in lowercase.

Ready to use your HTML skills?

Find web development internships and fresher jobs across India.

Browse Web Dev Internships