The simplest way to link to a PDF
To create a link to a PDF document, you upload the PDF file to your website's server, then write an HTML link that points to that file's location. The link works the same way as a link to any other web page — a visitor clicks it and the PDF opens in their browser or downloads to their computer, depending on their browser settings.
The HTML code for a basic PDF link looks like this: <a href="documents/myfile.pdf">Click here to read the guide</a>. The href attribute tells the browser where to find the file. The text between the opening and closing tags is what the visitor sees and clicks on.
If you use a website builder like WordPress, Wix, or Squarespace, you do not need to write HTML yourself. These platforms have a built-in button or menu option to insert a link — you select it, choose your PDF file from your media library, and the code is created automatically.
Key Takeaways
- Upload your PDF file to your website's server first, then create the link — the link cannot work if the file does not exist at that location.
- In HTML, use <a href="path/to/file.pdf">Link text</a>, where the path matches exactly where you stored the file.
- Website builders like WordPress and Wix have point-and-click link tools that write the code for you without typing HTML.
- You can control whether the PDF opens in the browser or downloads by adding download to the link code, or by adjusting your server settings.
Uploading the PDF to your server
Before you can link to a PDF, the file must live somewhere on the internet. If you have a website hosted with a company like GoDaddy, Bluehost, or your own hosting provider, you upload the PDF using a file manager or FTP client.
In most website builders, you upload through a media library or files section. In WordPress, go to Media → Add New and select your PDF file. In Wix, use the File Manager in your site editor. In Squarespace, use the File Block or the Files folder in your asset library. Once uploaded, the system assigns the file a URL — a web address you can use in your link.
Write down or copy the exact file path. If your file is in a folder called "documents" and named "guide.pdf", the path might be documents/guide.pdf or /documents/guide.pdf depending on your setup. The exact format matters — a typo will break the link.
Writing the link in HTML
If you are editing HTML directly, the link syntax is straightforward. The opening tag is <a href="path/to/file.pdf">, the clickable text goes in the middle, and the closing tag is </a>.
Here are three real examples:
- <a href="documents/guide.pdf">Download our safety guide</a> — links to a file in a "documents" folder
- <a href="https://example.com/files/report.pdf">View the annual report</a> — links to a PDF on a different website using the full web address
- <a href="guide.pdf" download>Download guide.pdf</a> — the download attribute forces the file to download instead of opening in the browser
The text between the tags is what visitors see. Make it clear what they are clicking — "Download our safety guide" is better than "Click here" because it tells them what to expect.
Controlling whether the PDF opens or downloads
By default, most browsers open PDFs in a viewer window when you click the link. Some visitors prefer to download the file instead. You can control this behavior with the download attribute in your HTML code.
Add the word download to the opening tag to force a download: <a href="documents/guide.pdf" download>Download the guide</a>. When a visitor clicks this link, their browser will save the file to their Downloads folder instead of opening it.
You can also specify what name the file should have when downloaded by adding a filename: <a href="documents/guide.pdf" download="Safety_Guide_2024.pdf">Download the guide</a>. This is useful if your file has a generic name on the server but you want visitors to save it with a more descriptive name.
If you use a website builder, look for a checkbox or toggle labeled "Download" or "Force download" when you insert the link. The builder will add the code for you.
Linking to a PDF on another website
You can link to a PDF hosted on someone else's website without uploading it yourself. Use the full web address instead of a relative path.
For example: <a href="https://example.com/files/report.pdf">Read the full report</a>. This link points to a PDF on example.com. The visitor's browser will fetch the file from that server and open or download it the same way.
The downside is that you depend on the other website to keep the file in that location. If they move or delete it, your link breaks. If you need the PDF to stay available long-term, upload a copy to your own server instead.
Testing your link
After you create a link, test it before publishing. Click the link yourself and confirm that the PDF opens or downloads as expected. Check that the file displays correctly and that all pages are readable.
If the link does not work, the most common causes are a typo in the file path, the file not being uploaded yet, or the file being in a different folder than you specified. Double-check the exact location of the file on your server and make sure the path in your link matches exactly — uppercase and lowercase letters matter.
If you are linking to a PDF on another website and the link breaks, contact the website owner or check their site to see if the file has moved.
Frequently Asked Questions
Can I link to a PDF without uploading it to my website?
Yes, if the PDF is already hosted somewhere else on the internet. Use the full web address in your link. However, if that website removes or moves the file, your link will break. For important documents you control, upload a copy to your own server.
What is the difference between a relative path and an absolute path?
A relative path like documents/guide.pdf tells the browser to look for the file in a folder relative to the current page. An absolute path like https://example.com/documents/guide.pdf is the complete web address. Use relative paths for files on your own website and absolute paths for files elsewhere.
Why does my PDF link show a broken link icon?
The file either has not been uploaded yet, the file path in your link is spelled differently than the actual file location, or the file is in a different folder. Check the exact spelling and location of the file on your server and update the link to match.
Can I make a PDF link open in a new browser tab?
Yes, add target="_blank" to the link: <a href="documents/guide.pdf" target="_blank">View the guide</a>. This opens the PDF in a new tab instead of replacing the current page. Most website builders have a checkbox for this option.