Are HTML tags case sensitive?

Advertisement

No. HTML tags are not case sensitive. You can write all HTML tags in lowercase or uppercase and they will be correctly rendered on a browser. This means that <h1>lowercase</h1> and <H1>UPPERCASE</H1> will work on any browser.

HTML uppercase or lowercase visualization

Can HTML tags be uppercase?

You can write HTML tags in uppercase and the webpage will correctly interprete the HTML tags.

Can HTML tags be lowercase?

You can write HTML tags in lowercase and the webpage will correctly interprete the HTML tags. This is generally the most agreed upon way to write HTML tags.

Can HTML tags be mixed case?

even if you write your HTML tags in mixed case, the browser will render them correctly.

Does case matter in HTML?

It does not matter which case you use when writing HTML tags. HTML tags can be uppercase, mixed case or lowercase. However there are a few exceptions.

WHATWG a body that works on improving the current version of HTML states:

’ Many strings in the HTML syntax (e.g. the names of elements and their attributes) are case-insensitive, but only for ASCII upper alphas and ASCII lower alphas. For convenience, in this section this is just referred to as “case-insensitive”.’

There are some places where case matters:

  • when writing some HTML entities that are used to display non-keyboard characters. e.g. To display uppercase Ñ  you need to use the entity with an uppercase:  &Ntilde; and a lowercase ñ you use lowercase entity &ntilde;.
  • When writing HTML attributes: eg. rel="" or src="".

are html attributes case sensitive

HTML attributes are case sensitive. They must correctly match the names of the attributes as indicated in the HTML5 specification.

is html code case sensitive

HTML code is case insensitive in terms of HTML tags and case sensitive in terms of HTML attributes.

what is case sensitive in html

  • HTML attributes are case sensitive.
  • Some HTML entitities are also HTML sensitive.

are html elements case sensitive

The HTML tags on HTML elements are not case sensitive but the attributes of the HTML elements are Case sensitive.

HTML Case recommendation

  1. It is generally recommended that you use lowercase in HTML. I think its also easier to write HTML in lowercase as long as you are typing your sentences in lowercase.

  2. If you click on inspect on a page written in uppercase HTML code, you will find that the browser seems to have converted all the tags to lowercase.

Source:

  1. HTML entities - DevPractical
  2. HTML case - WHATWG
author's bio photo

Hi there! I am Avic Ndugu.

I have published 100+ blog posts on HTML, CSS, Javascript, React and other related topics. When I am not writing, I enjoy reading, hiking and listening to podcasts.