Are HTML 5 Tags Case Sensitive?

Best practices for writing HTML 5 elements

New web designers may wonder whether or not HTML tags are case sensitive. While the short answer is "no," there are some important rules and best practices to consider when writing your HTML markup.

HTML code for building a web form
Gary Conner / Photolibrary / Getty Images

Throwing It Back to XHTML

Before HTML5 came onto the scene, web professionals would use a different markup language flavor called XHTML to build their web pages. 

The rules were stricter with XHTML, which is case sensitive. In XHTML, you'd write all standard tags in lowercase. For example, in XHTML, the tag <HTML> is different from <html>. You had to be very specific about how you coded an XHTML web page, using only lowercase characters.

This strict rule was actually a benefit to many new web developers. Instead of being able to write markup with a mix of lowercase and uppercase, they knew they must follow an exact format.

For anyone who cut their teeth in web design when XHTML was popular, the very idea that markup could be a mix of uppercase and lowercase would seem strange.

HTML5 Gets Loose

Prior versions of HTML weren't case-sensitive, and HTML5 followed along with this tradition, moving away from XHTML's stricter formatting requirements.

Since HTML 5 isn't case-sensitive, <HTML> and <html> and <HtMl> are all the same tag.

The idea behind HTML5 eschewing case-sensitivity was to make it easier for new web professionals to learn the language. However, many experienced professionals disagree, arguing that giving web design students a definitive set of rules, such as "always write your HTML as lowercase," is more straightforward. Too much rule flexibility may confuse new web design students.

Lowercase Is an HTML5 Convention

While it's not a strict rule, writing HTML5 tags in all lowercase is a widely used convention. This is partly because many seasoned web developers, who lived through the days of strict XHTML, carried over those best practices to HTML5 and beyond. While a mix of uppercase and lowercase letters is valid, many web designers prefer to stick to all lowercase letters.

As newer web developers examine more experienced professionals' code, they'll notice the all-lowercase markup and likely continue this practice.

Best Practices for Letter Casing

Many experts agree that using lowercase letters for HTML code, as well as for filenames, is helpful. Because certain servers are case-sensitive when it comes to filenames (for example, "logo.jpg" will be seen differently than "logo.JPG"), if you have a workflow where you always use lowercase letters, you never need to question whether or not casing is causing a problem, such as missing images.