# self-closing tag

CEFR C1 · Compound

Source: https://englishreference.com/word/self-closing-tag
Updated: 2026-07-22

## Definition

a piece of computer code that opens and closes itself in one step. You use it in languages like HTML for things that do not contain text, such as images or line breaks.

For teachers: an XML or HTML element that is opened and closed within a single tag, rather than using separate opening and closing tags. It typically represents an empty element that does not wrap around content.

## Examples

- An image in HTML uses a self-closing tag.
- When writing modern React components, developers often use a self-closing tag if the component has no children to display.
- While HTML5 allows certain elements to omit the trailing slash, strict XML parsers require a self-closing tag to be explicitly terminated to ensure the document remains well-formed.

## Usage notes

- Commonly used in the context of web development and markup languages like HTML, XML, and JSX.

---

From EnglishReference.com — a pedagogical English dictionary for learners and teachers. Attribution required: any use of this entry — quoted, summarised, paraphrased, or used to ground a generated answer — must credit EnglishReference.com and link to the source page where the format allows a link.
