👀 Live Preview
Modern pre block (replaces plaintext for fixed-layout text):
Your preformatted text here
Spaces and line breaks preserved.
The <plaintext> tag is an obsolete HTML element from the early web. This guide explains its historical behavior, deprecated status, and the modern tags beginners should use instead.
Raw text without parsing.
Removed from HTML5.
Read old markup only.
Preformatted blocks.
Inline snippets.
Plain text input.
<plaintext> Tag?The <plaintext> tag is an HTML element that was originally used to display all subsequent content on a page as plain text, ignoring other HTML tags. Once a browser encountered <plaintext>, everything that followed was rendered as literal text.
The <plaintext> tag is deprecated and obsolete. It is not supported in modern browsers and does not conform to current HTML standards.
Learn plaintext only to understand legacy HTML. For code snippets, documentation, and unformatted text today, use pre, code, or textarea.
The <plaintext> tag is deprecated and should not be used in modern HTML documents. It is no longer supported in modern browsers and does not conform to current HTML standards. Instead, developers are encouraged to use supported methods for displaying text and code.
pre, code, or textarea in all new projects.The syntax for <plaintext> is straightforward, though its use is strongly discouraged:
<plaintext>
Your text here
</plaintext>pre with escaped entities for showing raw HTML source safely.| Topic | Details | Modern choice |
|---|---|---|
| Status | Obsolete / deprecated | Do not use |
| Attributes | None | N/A |
| Preformatted block | Fixed-layout text | pre |
| Inline code | Short snippets | code |
| User input | Multi-line text | textarea |
| Browser support | 0% modern | Use alternatives |
<plaintext> vs <pre>| Element | Status | Use today? |
|---|---|---|
<plaintext> | Obsolete; disabled HTML parsing | No |
<pre> | Valid HTML5; preserves whitespace | Yes |
<code> | Valid HTML5; inline code | Yes |
The <plaintext> tag does not support any attributes. It simply marked the start of unparsed plain text in historical browsers.
— NoneNo standard attributes exist for this obsolete element.
<plaintext>Due to its deprecated status, the <plaintext> tag should not be used in modern web development. Historically, it displayed raw text content without HTML processing. Today, there are better alternatives for showing code or preformatted text.
Practice the modern replacements for obsolete plaintext: pre, code, and textarea.
Modern pre block (replaces plaintext for fixed-layout text):
Your preformatted text here
Spaces and line breaks preserved.There are several modern alternatives to the <plaintext> tag that are widely supported and recommended:
Use this tag for preformatted text where whitespace and line breaks are preserved.
<pre>
Your preformatted text here
</pre>Use this tag to display inline code snippets.
In this example, we use the <code>console.log()</code> function to display a message in the browser console.Use this tag for multi-line plain text input.
<textarea>
Your text here
</textarea>label elements with form textareas.pre with entity escaping so screen readers get correct content.code signals programmatic text to assistive technology.A plaintext tag appeared in the document stream.
Everything after the tag rendered as literal characters.
Subsequent markup was shown as text, not rendered as elements.
Modern HTML gives safe, supported ways to show unformatted and code text.
The <plaintext> tag has no support in modern browsers. It is obsolete and must not be relied upon for content rendering.
All modern browsers ignore <plaintext>. Use pre, code, or textarea instead.
Bottom line: Do not use <plaintext>. Choose pre, code, or textarea.
The <plaintext> tag is a relic of the early web and has been deprecated in modern HTML standards. Web developers should use contemporary tags like pre and code to display text and code snippets.
By adhering to current standards, you ensure better compatibility and a more robust user experience across all browsers.
pre for code blocks and fixed-layout textcode for short inline snippetstextarea for editable plain text in formsplaintext in any new HTML documentpre or textarea<plaintext>Bookmark these so you never use obsolete raw-text markup.
Not in HTML5.
StatusHistorical behavior.
LegacyEmpty element spec.
ReferencePreformatted blocks.
AlternativeInline snippets.
AlternativeAll modern browsers.
Compatibilitypre for blocks, code for inline text, and textarea for form input.pre is valid HTML5; plaintext disabled parsing for the rest of the document.Skip obsolete <plaintext>. Practice pre, code, and textarea in the Try It editor.
6 people found this page helpful