The basic way to link to a website
A link to a website is created using HTML code, even if you never write HTML yourself. When you paste a URL into most programs — email, social media, document editors, website builders — the software converts it into a clickable link automatically. If you are writing HTML directly, you use an anchor tag, which looks like this: <a href="https://www.example.com">Click here</a>. The part in quotes is the URL you want to link to. The text between the opening and closing tags is what readers see and click on.
The URL must be complete and correct. A link to "example.com" might work in a browser's address bar, but in HTML code it should be "https://www.example.com" — including the protocol (https:// or http://). If the URL is wrong or incomplete, the link will either break or take the reader to the wrong place.
Key Takeaways
- Most software automatically converts pasted URLs into clickable links, so you often do not need to write code yourself.
- In HTML, a link uses an anchor tag with the format <a href="URL">link text</a>, where the URL must include https:// or http://.
- The text readers see (the "link text") should describe where the link goes, not just say "click here".
- You can link to a specific page on a website by using its full URL, not just the homepage.
Where to find the URL you want to link to
The URL is in your browser's address bar at the top of the window. Click on the address bar, select all the text, and copy it. That is the complete URL for the page you are viewing. You can paste this into an email, document, or HTML code, and it will work as a link.
Be careful to copy the entire address. If you copy only part of it — for example, just "example.com" without the "https://" — the link may not work correctly in all contexts. Some programs are forgiving and add the protocol automatically, but HTML code is not.
How to write link text that makes sense
The words readers click on should tell them where the link goes. Instead of "click here" or "link," use something specific like "Read the full article about solar panels" or "Visit the National Weather Service." This helps readers decide whether to click, and it also helps people using screen readers understand what the link does.
Search engines also pay attention to link text. If many links say "click here," search engines learn less about what those pages are about. If links say "How to fix a leaky faucet," search engines understand the topic better.
Linking to a specific part of a page
You can link not just to a page, but to a specific section within it. This requires an anchor — a marker placed on the page you are linking to. The person who built that page has to add the anchor first. Once it exists, you link to it by adding a hash symbol and the anchor name to the URL: <a href="https://www.example.com/page#section-name">Jump to section</a>.
Not every website has anchors set up. If you are linking to your own page or a page you control, you can add anchors yourself using <a id="section-name"></a> or by adding an id attribute to a heading. If you are linking to someone else's page and you are not sure whether an anchor exists, try adding #section-name to the URL and see if it jumps to that section.
Opening a link in a new tab or window
By default, a link opens in the same tab or window where the reader clicked it. If you want the link to open in a new tab instead, add target="_blank" to the anchor tag: <a href="https://www.example.com" target="_blank">Open in new tab</a>. This is useful when you want readers to stay on your page while also viewing the linked page.
Some people prefer links to open in new tabs because it does not interrupt their reading. Others find it annoying because it creates clutter. There is no universal rule — use your judgment based on context. If you are linking to an external resource that readers might want to reference while staying on your page, a new tab makes sense. If you are linking to the next page in a sequence, the same tab is usually better.
Testing your links
After you create a link, click it to make sure it goes where you intended. Check that the page loads completely and that you end up on the right URL. If the link is broken, the browser will show an error page — usually a 404 message saying the page was not found.
If a link breaks, the most common causes are a typo in the URL, a page that has moved or been deleted, or a URL that was correct when you created the link but changed later. If you are linking to a page you do not control, check it occasionally to make sure it still exists.
Frequently Asked Questions
Do I need to know HTML to create a link?
No. Email programs, word processors, social media platforms, and website builders all let you create links by pasting a URL or highlighting text and selecting "add link" from a menu. The software handles the HTML for you. You only need to write HTML directly if you are building a website from scratch or editing HTML code.
What is the difference between http and https?
HTTPS is a secure version of HTTP that encrypts data between your browser and the website. Most websites now use HTTPS. Both will work in a link, but HTTPS is safer. If you copy a URL from your browser's address bar, it will include whichever one the website uses.
Can I link to a PDF or other file instead of a webpage?
Yes. Use the full URL to the file, just as you would for a webpage: <a href="https://www.example.com/document.pdf">Download the PDF</a>. The browser will either open the file or prompt the reader to download it, depending on their settings.
What happens if I link to a website that later disappears?
The link becomes broken. Readers who click it will see an error page. If you are linking to external websites, check them occasionally to make sure they still exist. If a link is important to your content, consider whether you should link to it at all, or whether you should save a copy of the information yourself.