HTML pre Tag (original) (raw)

Last Updated : 28 May, 2026

The

 tag in HTML is used to display preformatted text exactly as written in the source code. It preserves spaces, line breaks, and indentation in the webpage.

        This    is      preformatted
        text.
        It preserves spaces and
        line breaks exactly.

`

**Note: The pre tag also supports the Event Attributes in HTML and Global Attributes in HTML.

Tag Description
Defines sample output from a computer program
Defines a variable
Defines a piece of computer code.
Defines keyboard input

Using CSS with the
 Tag

HTML `

        This    is      preformatted
        text.
        It preserves spaces and
        line breaks exactly.

`