<plaintext>

The <plaintext> element in HTML is used to display text exactly as it is, ignoring any HTML tags and rendering them as plain text.
This feature is no longer advisable for use. While some browsers may still support it, it could already be removed from web standards, be in the process of being phased out, or remain only for compatibility reasons. It’s best to avoid using it and update any existing code if possible.
For guidance, refer to the compatibility table below. Keep in mind that this feature may stop working at any time.

plaintext tag

The <plaintext> tag instructs the browser to treat its content as plain text, ignoring any HTML tags. The content appears in a monospaced font, which can also be applied to other elements using the CSS font-family property with the monospace value.

The <plaintext> element in HTML renders all content after its opening tag as plain text, treating it as unformatted and ignoring any subsequent HTML. This element does not require a closing tag, as everything following it is interpreted as raw text.

Attributes

The <plaintext> tag supports global attributes.

See also

  • The <pre> and <code> elements as alternatives.
  • The <listing> and <xmp> elements, which are similar to <plaintext> but are also obsolete.
The <plaintext> tag has been obsolete since HTML2 and was never consistently supported across browsers. Some browsers that recognize it may treat it similarly to the <pre> tag while still interpreting HTML content inside it.
If <plaintext> is the first element in a document (excluding non-displayed elements like <head>), the page should not use HTML at all. Instead, serve the content as a plain text file with the text/plain MIME type.
  • Use the <pre> tag for preformatted text.
  • If the content represents code, use the <code> tag for better semantic meaning.
  • To prevent HTML parsing issues, escape special characters such as <, >, and &.
  • Apply a monospaced font to any element using CSS with font-family: monospace;.

Conclusion

The <plaintext> tag in HTML has been obsolete since HTML2 and is no longer recommended due to inconsistent browser support. For displaying raw text, it's better to use the <pre> tag, which preserves whitespace and formatting, or the <code> tag for representing code. Applying a monospaced font via CSS is also a viable alternative. These modern solutions provide better compatibility, clarity, and semantic meaning while ensuring that your content is displayed correctly across different browsers.