The <plaintext> element once made everything after its start tag raw text, ignoring following HTML. There was no closing tag.
Do not use it. Prefer <pre> for blocks or <code> for inline samples. Escape <, >, and &. For a whole plain-text document, serve text/plain instead of HTML.
Deprecated · Obsolete.
Deprecated since HTML 2. Never consistent across browsers. Some engines may treat it like a <pre> that still parses HTML. Avoid in every new project.
Study-only examples.
Legacy snippets exist so you can recognize old markup. Prefer the pre / code versions.
Syntax
HTML Syntax
syntax.html
<plaintext>raw text to end of file…
Historical form only — start tag, no end tag. Prefer this modern equivalent:
prefer.html
<pre><code><p>Hello</p></code></pre>
Reference
Attributes
<plaintext> had no element-specific attributes. Only globals applied historically:
Paste the sample; escape < / > / & when the sample is HTML.
Close both tags so the rest of the page stays normal HTML.
Edge Cases & Pitfalls
Most plaintext problems come from copying historical behavior into modern pages.
obsolete
Never consistent
Deprecated since HTML 2. Engines differed then and still differ now. Never build new UI on it.
danger
No closing tag
Historical design swallowed the rest of the document. That can break layouts and scripts if an engine still approximates the old rule.
escape
Escape in pre/code
To show HTML as text, use <, >, and &. Do not rely on a raw-text element.
mime
Whole-document plain text
If the entire response should be plain text, serve Content-Type: text/plain — do not wrap an HTML page in plaintext.
related
Also obsolete: xmp, listing
Similar historical raw-text ideas. Prefer pre / code for all of them.
Compatibility
Browser Support
The <plaintext> element is legacy HTML. It is not a Node.js, Deno, or Bun API.
✓ Deprecated · Obsolete
<plaintext>
Never reliably standardized. Some browsers may map it toward pre-like rendering. Prefer pre and code with escaped characters.
—Do not use in new work
Google ChromeLegacy
Non-standard / remapped
Mozilla FirefoxLegacy
Non-standard / remapped
Apple SafariLegacy
Non-standard / remapped
Microsoft EdgeLegacy
Non-standard / remapped
OperaLegacy
Non-standard / remapped
Samsung InternetLegacy
Non-standard / remapped
Internet ExplorerLegacy
Historical
<plaintext>Obsolete (use pre/code)
Bottom line: Recognize plaintext in very old markup, then replace it with pre/code. Never ship new pages that depend on it.
Remember
Key Takeaways
Status:<plaintext> is obsolete — avoid in new HTML.
History: start tag only; following HTML was meant to be raw text.
Replace with:pre, code, and escaped < / > / &.
Whole file: use text/plain, not an HTML element.
One line: recognize <plaintext> in old pages; show text samples with pre/code.
UA style
Default CSS Settings
There is no modern standard stylesheet for <plaintext>. Engines that remap it often behave like pre:
prefer.css
/* Prefer styling modern elements */
pre, code {
font-family: monospace;
}
pre {
white-space: pre;
}
Apply font-family: monospace with CSS when you want a fixed-width look — not via obsolete tags.
Frequently Asked Questions
Historically, plaintext made everything after its start tag raw text and ignored following HTML. There was no closing tag. It is obsolete.
No. It has been deprecated since HTML 2 and is obsolete. Do not use it in new projects.
Use pre for preformatted blocks, or code for inline code. Escape <, >, and & so browsers do not parse them as markup. For a whole plain-text document, serve text/plain.
Support was never consistent. Some engines may treat it like a pre that still interprets HTML. Do not rely on it.
No. text/plain is an HTTP content type for an entire response. The plaintext element was obsolete HTML markup inside a page.
Put the sample in pre or code and escape characters: < for <, > for >, and & for &.