Short answerAn HTML link is <a href="URL">text</a>. href sets the destination (web URL, relative path, #section, mailto:, tel:); target="_blank" opens a new tab; rel describes the relationship (noopener, nofollow, sponsored, ugc); download makes the browser save the file.
The basic link
<a href="https://example.com/">Example</a>
Prefer a generator? The URL to HTML link tool writes this for you.
Kinds of href
| href value | Goes to |
|---|---|
https://other.com/page | An absolute URL on any site |
about.html | A file next to the current page |
../index.html | One folder up |
/contact/ | From the root of the current site |
#pricing | The element with id="pricing" on this page |
mailto:hi@example.com | A new email (generator) |
tel:+441234567890 | A phone call on mobile |
sms:+441234567890 | A text message on mobile |
target
_self (default) opens in the same tab, _blank in a new one. Use new tabs sparingly — for external references or downloads while a form is half-filled — because they break the Back button.
rel
noopener— the new tab cannot reach back viawindow.opener.noreferrer— also hides which page sent the visitor.nofollow— do not pass ranking credit; use for untrusted links.sponsored— paid or affiliate links.ugc— links in comments and forum posts.
download
<a href="/files/price-list.pdf" download="price-list-2026.pdf">Download the price list</a>
Works for same-origin files; browsers ignore it for cross-site URLs.
Accessible link text
- Describe the destination: “Read the refund policy”, not “click here”.
- Make links visibly different from text — underline or a clear colour.
- Warn about new tabs or file downloads in the text: “(PDF, 2 MB)”.
- Image links need
alttext describing the destination.
Common mistakes
- Missing
https://:href="example.com"is treated as a relative path. - Nesting links inside links — invalid HTML, unpredictable behaviour.
- Using
<a>withouthrefas a button — use<button>for actions. - Links to
file://paths — they only work on your machine. Convert the page to a link first.