List of HTML Self-Closing Tags

By Xah Lee. Date: . Last updated: .

Here's a complete list of self-closing tags for HTML5. These are called “void-elements” in HTML spec.

html close all the tags cartoon
<area />
<base />
<br />
<col />
<command />
<embed />
<hr />
<img />
<input />
<keygen />
<link />
<meta />
<param />
<source />
<track />
<wbr />

The space before the slash is optional.

For a list of all HTML5 tags, see: HTML5 Tags Complete List.

Is the Ending Slash Optional?

I recommend to always add the slash. Because, it provides a visual clue of non-closing tags. It's also convenient if you write simple script to check your HTML, without a lookup table or using heavy HTML parser.

XHTML Supports Self-Closing Syntax for All Tags

In XML/XHTML, any tag can be self-closed by the ending slash <… />.

When you test XML, you have to make sure the server is sending the correct Internet media type as XHTML (For example, application/xhtml+xml), otherwise browsers will treat it as HTML, regardless of the DOCTYPE in your file.


Like what you read? Buy JavaScript in Depth
or, buy a new keyboard, see Keyboard Reviews.