Blog
Wild & Free Tools

Less Than and Greater Than in HTML: < and >

Last updated: March 2026 4 min read
Quick Answer

Table of Contents

  1. Why They Break HTML
  2. The Entities
  3. Common Use Cases
  4. Inside code and pre tags
  5. Frequently Asked Questions

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: &lt; for < and &gt; 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.

&lt; and &gt;: The Entities to Use

CharacterNamed EntityNumeric EntityMeaning
<&lt;&#60;Less than, opening angle bracket
>&gt;&#62;Greater than, closing angle bracket

Both named entities (&lt; / &gt;) and numeric entities (&#60; / &#62;) 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 Shipping

Where You Need &lt; and &gt; 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 &lt;strong&gt; 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 &lt; 10" renders as "x < 10". "Score &gt; 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>&lt;div class="container"&gt;...&lt;/div&gt;</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 Tool

Frequently Asked Questions

What is the HTML entity for less than (<)?

Use &lt; — it stands for "less than." The numeric equivalent is &#60;. Both render the < character without it being interpreted as a tag.

What is the HTML entity for greater than (>)?

Use &gt; — it stands for "greater than." The numeric equivalent is &#62;. 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 &gt; 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 &lt; and every > with &gt;. The tag becomes visible text rather than being parsed as markup.

Andrew Walsh
Andrew Walsh Developer Tools & API Writer

Andrew worked as a developer advocate at two SaaS startups writing API documentation used by thousands of engineers.

More articles by Andrew →
Launch Your Own Clothing Brand — No Inventory, No Risk