Less Than and Greater Than in HTML: < and >
- < and > are reserved in HTML — browsers treat them as tag delimiters
- Use < for < and > for > to display them literally
- Most critical when showing code examples, math, or comparison operators
- Free encoder converts them automatically along with all other reserved characters
Table of Contents
The angle brackets < and > are the foundation of HTML syntax — they open and close every tag. That makes them two of the most problematic characters to display literally on a web page. Put a raw < in your content and the browser starts looking for a tag name. Put > alone and the parser may behave unpredictably.
The fix is two simple entities: < for < and > for >.
Why Raw < and > Break HTML
HTML parsers tokenize markup by scanning for <. When they find one, they expect a tag name to follow. If the character sequence does not match a known tag or valid syntax, browser behavior varies: some display the character anyway, some silently drop it, some produce validation errors, and some misinterpret the surrounding content.
In practice, a raw < in body text usually renders fine in modern browsers — they are lenient. But it will fail HTML validation, break XML and XHTML parsers, cause problems in RSS/Atom feeds (which are strict XML), and create issues in templating engines and CMS editors that process content before rendering.
The safe rule: any < or > that is meant to be displayed as a character (not parsed as markup) should be encoded.
< and >: The Entities to Use
| Character | Named Entity | Numeric Entity | Meaning |
|---|---|---|---|
| < | < | < | Less than, opening angle bracket |
| > | > | > | Greater than, closing angle bracket |
Both named entities (< / >) and numeric entities (< / >) work identically. Named entities are preferred — they are more readable and immediately recognizable to anyone who works with HTML.
Sell Custom Apparel — We Handle Printing & Free ShippingWhere You Need < and > Most Often
Code examples and documentation
This is the most common need. Any page that shows HTML, XML, or code containing angle brackets needs encoding. Without it, the browser renders the tags instead of displaying them:
Wrong: Use the <strong> tag for bold text. — The browser renders this as: "Use the tag for bold text." — the tag disappears and the following text turns bold.
Correct: Use the <strong> tag for bold text. — Renders as: "Use the <strong> tag for bold text." — the tag is visible as text.
Math and comparisons
Displaying formulas or comparisons: "x < 10" renders as "x < 10". "Score > 95" renders as "Score > 95".
Template literals in content
CMS content or email templates that contain angle bracket syntax from a templating language need encoding to display the template syntax rather than have it processed as HTML.
Using <code> and <pre> Tags — Still Need Encoding
A common misconception: putting content inside <code> or <pre> tags does not bypass HTML parsing. The browser still parses the content for HTML entities and tags. You still need to encode angle brackets even inside these elements.
Example — this does NOT work:<pre><div class="container">...</div></pre>
The browser renders the div tag rather than showing it.
This DOES work:<pre><div class="container">...</div></pre>
The encoded entities display as literal characters inside the pre block.
Code syntax highlighters (Prism, Highlight.js) handle this encoding automatically when you use their API. But if you are writing raw HTML, manual encoding or using an encoder tool is necessary.
Encode < and > Automatically
Paste your HTML or text. All angle brackets and special characters encoded. Free.
Open Free HTML Entity ToolFrequently Asked Questions
What is the HTML entity for less than (<)?
Use < — it stands for "less than." The numeric equivalent is <. Both render the < character without it being interpreted as a tag.
What is the HTML entity for greater than (>)?
Use > — it stands for "greater than." The numeric equivalent is >. Both render the > character safely.
Do I need to encode > in HTML body text?
Technically > alone is not ambiguous for the parser and most browsers render it fine without encoding. But encoding it as > is best practice for strict compliance and XML/RSS feeds.
How do I display HTML tags as text on a page?
Encode the angle brackets: replace every < with < and every > with >. The tag becomes visible text rather than being parsed as markup.

