HTML rel Attribute

Beginner
6 min read
Updated: Oct 2026
3 examples
Live preview

Definition and Usage

The rel attribute names the relationship between the current document and a linked URL. It is valid on <link>, <a>, <area>, and <form>. The value is an unordered set of unique space-separated keywords (link types).

Unlike class, tokens must be meaningful. Common cases: load a stylesheet (rel="stylesheet"), set a favicon (rel="icon"), or harden target="_blank" links (rel="noopener noreferrer").

Baseline · Widely available.

Not deprecated as an attribute. Allowed keywords depend on the element — check the value table below.

Do not write rel="shortcut icon".

shortcut is non-conforming and ignored. Use rel="icon" only. apple-touch-icon is a separate non-standard iOS keyword.

HTML Syntax

syntax.html
<link rel=" stylesheet | icon | canonical | …">
<a rel=" noopener noreferrer | nofollow | …">

In JavaScript: element.rel (string) or element.relList (token list API).

Attribute Values

Most useful everyday keywords (not the full registry):

ValueTypical elementMeaningTry it
stylesheet<link>Load a CSS fileTry it
icon<link>Favicon / document iconTry it
canonical<link>Preferred URL for this documentTry it
noopener<a> / <area>No window.opener for new contextsTry it
noreferrer<a> / <area>No Referer + noopener effectTry it
nofollow<a> / <area>Hint: do not endorse / crawl as endorsementTry it

Also common on <link>: preload, preconnect, dns-prefetch, manifest, alternate. Full list lives in the HTML link types / IANA registry.

Live Preview

Pick a keyword to see a short meaning and sample markup.

rel keyword

Keywords are space-separated and case-insensitive.

Sample

HTML Examples

Short demos for <link> and <a>. Use Try It Yourself for a live editor.

Example 2 — Secure target="_blank"

Combine noopener and noreferrer on new-tab links.

HTML
<a href="https://example.com/"
   target="_blank"
   rel="noopener noreferrer">
  Open example.com in a new tab
</a>
Try It Yourself

How It Works

  1. target="_blank" opens a new browsing context.
  2. noopener keeps window.opener null for that tab.
  3. noreferrer also omits Referer (and implies noopener).
  4. Space-separated tokens apply together.

Example 3 — nofollow Annotation

Mark a link that should not be treated as an endorsement for crawlers.

HTML
<p>
  Sponsored:
  <a href="https://example.com/offer" rel="nofollow sponsored">
    Partner offer
  </a>
</p>
Try It Yourself

How It Works

  1. nofollow is an annotation on the hyperlink.
  2. Crawlers may treat it as “no endorsement.”
  3. Extra tokens (like sponsored) can be added when appropriate.
  4. Users can still click — rel does not disable the link.

Edge Cases & Pitfalls

Wrong element + keyword pairs are the usual mistake.

element

Keywords are element-specific

stylesheet / icon belong on <link>. noopener belongs on hyperlinks, not stylesheets.

legacy

Skip shortcut icon

Non-conforming. Write rel="icon".

ios

apple-touch-icon is non-standard

Common for iOS home-screen icons, but not an HTML standard link type.

blank

Always consider noopener with _blank

Prevents the new page from reaching window.opener on your tab.

old

prerender is superseded

Prefer modern speculation / prefetch mechanisms instead of relying on rel="prerender".

Browser Support

rel is an HTML attribute for link types. Support for individual keywords varies slightly, but core values are ubiquitous.

✓ Baseline · Widely available

rel

Supported on link, a, area, and form. Everyday values (stylesheet, icon, noopener, noreferrer, nofollow) work across modern browsers.

98% Global support (approx.)
Google Chrome Yes
Full support
Mozilla Firefox Yes
Full support
Apple Safari Yes
Full support
Microsoft Edge Yes
Full support
Opera Yes
Full support
Samsung Internet Yes
Full support
Internet Explorer Yes*
Core values; some keywords limited
rel Widely supported

Bottom line: Safe to use. Match the keyword to the element, prefer icon over shortcut icon, and harden _blank links with noopener.

Key Takeaways

  • Role: name the relationship of a linked resource.
  • Space-separated unique keywords; element decides which are valid.
  • link: stylesheet, icon, canonical… a: noopener, noreferrer, nofollow…
  • Avoid shortcut icon; use icon.

One line: rel tells browsers and tools how a URL relates to this page — stylesheet, icon, security hints, and more.

Frequently Asked Questions

It names the relationship between the current document and a linked resource as space-separated link-type keywords. Valid values depend on whether you use it on link, a, area, or form.
Yes. Separate unique keywords with spaces, for example rel="noopener noreferrer". Order does not matter.
Use rel="noopener" (and usually noreferrer). Modern browsers often imply noopener for _blank, but stating it is still good practice.
No. shortcut is non-conforming and ignored. Use rel="icon" only.
On <link>, not on <a>. Anchors use annotation types like nofollow, noopener, and noreferrer.
No. It is a core HTML attribute. Some individual keywords (for example prerender) are obsolete or superseded; most common values remain current.

Next: required

Mark form controls that must be filled before submit.

required tutorial →

About the author

Mari Selvan M P
Mari Selvan M P 🔗

Developer, cloud engineer, and technical writer

  • Experience 12 years building web and cloud systems
  • Focus Full Stack Development, AWS, and Developer Education

I write practical tutorials so students and working developers can learn by doing—from databases and APIs to deployment on AWS.

8 people found this page helpful