What Is An HTML Tag Versus an HTML Element?

Tags are a constitutent part of a complete element

An HTML tag is an indication to a web browser of how a web page should displayed, but an HTML element is an individual component of HTML. HTML elements are created using HTML tags.

Many people use the terms tag and element interchangeably, and any web designer or developer you speak with would understand what you meant, but the reality is that there is a slight difference between the two terms.


HTML is a markup language, which means that it is written with codes readable by a person without it needing to be compiled first. In other words, the text on a web page is “marked up” with these codes to give the web browser instructions about how to display the text.

When you write HTML, you are writing HTML tags. All HTML tags are made up of a number of specific parts. They specify the tag name between angle brackets, the content that the tag affects, and various attributes affecting the tag in a name/value pair.

Here's an example:


This snippet displays an anchor tag, which specifies a hyperlink. The tag opens and closes. The rel attribute takes the value nofollow.

In HTML, the difference between an opening tag and a closing tag is the presence of the slash. For example, is always an opening anchor tag, and is always a closing anchor tag.

Taken together, the opening and closing tags and all that appear between them constitute an HTML element.

What Are HTML Elements?

According to the W3C HTML specification, an element is the basic building block of HTML and is typically made up of two tags: an opening tag and a closing tag.

Almost all HTML elements have an opening tag and a closing tag. These tags surround the text that will display on the web page. For example, to write a paragraph of text, you write the text to display on the page and then surround it with these tags:

This text is an example of a paragraph.

Some HTML elements do not have a closing tag; they're called empty elements. Sometimes, they are also referred to as singleton or void elements. Empty elements are easy to use because you only have to include one tag in your web page and the browser will know what to do. For example, to add a single line break to your page, use the tag.

Another common element that only includes an opening tag is the image element. For example:

In general, developers use the term element to indicate all parts of the element (both the opening and closing tags). They use tag when referring only one or the other. This is the proper use of these two terms.

mla apa chicago
Your Citation
Kyrnin, Jennifer. "What Is An HTML Tag Versus an HTML Element?" ThoughtCo, Apr. 5, 2023, thoughtco.com/html-tag-vs-element-3466507. Kyrnin, Jennifer. (2023, April 5). What Is An HTML Tag Versus an HTML Element? Retrieved from https://www.thoughtco.com/html-tag-vs-element-3466507 Kyrnin, Jennifer. "What Is An HTML Tag Versus an HTML Element?" ThoughtCo. https://www.thoughtco.com/html-tag-vs-element-3466507 (accessed June 1, 2023).