Written and maintained by CASRAI Editorial Board
Last updated
To make a clickable link in LaTeX, load the hyperref package in the preamble, then write \href{URL}{link text} for a link with your own wording or \url{URL} to show the address itself. This guide is for researchers and analysts preparing PDFs of papers, theses and reports, and it ends with the settings that decide whether links appear as blue text, coloured boxes or nothing at all.
What it is used for in research
Hyperlinks in a LaTeX PDF let readers jump to a dataset, a repository, a DOI landing page or another place in the document (a section, figure or citation). The hyperref package adds this hypertext support, and the same package also sets PDF metadata such as title and author. Links to citations and bibliography entries are made clickable by the same package.
Install or access (official source only)
hyperref is distributed through CTAN, the Comprehensive TeX Archive Network. The CTAN package page (checked 2026-11-07) lists version 7.01t dated 2026-11-03, the LaTeX Project Public License 1.3, and support for the dvips, dvipdfm, pdfTeX, TeX4ht and VTeX backends. If you use a local TeX distribution, see MacTeX or your distribution’s package manager; if you edit in a browser, see what Overleaf is. In either case you enable the package with one line in the preamble.
Step-by-step: how to do a link in LaTeX
How do I insert a clickable link (and create clickable hyperlinks)?
Add the package, then use \href or \url. The examples below follow Overleaf’s hyperlinks documentation (checked 2026-11-07).
- In the preamble, add
\usepackage{hyperref}. Load it after your other packages: the hyperref manual says to make sure it “comes last of your loaded packages” and not to load it in\AtBeginDocumentor the\begindocumenthook. - For a link with custom text, write
\href{http://www.overleaf.com}{Something Linky}. The first argument is the target and the second is the text readers see. - To print the address itself as the clickable text, write
\url{http://www.overleaf.com}. - For a link to a local file, use the
run:form, for example\href{run:./file.txt}{File.txt}. - For a link inside the document, mark a spot with
\hypertarget{name}{text}and link to it with\hyperlink{name}{text}. To link to a labelled section, figure or equation,\hyperref[label]{text}links to the same place\ref{label}would.\autorefreplaces\refand puts a contextual label (such as the word for the object type) in front of the number. - Compile as usual; recompile if cross-references or the table of contents look out of date.
Link, hyperlink and URL: the variants answered
“LaTeX link”, “latex hyperlink”, “hyperlink in latex” and “latex url” all describe the same task. The two commands differ by purpose: \href hides the address behind text of your choosing; \url shows the address. \nolinkurl writes a URL in the same way as \url but without creating a hyperlink (hyperref manual, checked 2026-11-07).
Output and how to read it: how to make a link blue in LaTeX
By default hyperref does not colour link text; it draws a box around each link instead. The manual describes pdfborder as defaulting to a box with lines of 1pt thickness, and says colorlinks (default false) resets it to produce no border. To get blue link text, put this after the package is loaded:
\hypersetup{colorlinks=true, linkcolor=blue, urlcolor=blue, citecolor=blue}
Overleaf’s own example is \hypersetup{colorlinks=true, linkcolor=blue, filecolor=magenta, urlcolor=cyan, pdftitle={Overleaf Example}, pdfpagemode=FullScreen,}. You can also pass the options when loading: \usepackage[colorlinks=true, urlcolor=blue]{hyperref}.
Which option controls which link (decision table)
| You want | Setting | What the hyperref manual says |
|---|---|---|
| Coloured text for links | colorlinks=true |
Default false; “Colors the text of links and anchors.” |
| A colour for internal links such as section and figure references | linkcolor |
Default red; “Color for normal internal links.” |
| A colour for web addresses | urlcolor |
Default magenta; “Color for linked URLs.” |
| A colour for in-text citations | citecolor |
Default green; “Color for bibliographical citations in text.” |
| No colour and no box at all | hidelinks |
“Hide links (removing color and border).” |
| Boxes without the default 1pt lines | pdfborder |
Default 0 0 1. |
Whether coloured links, boxed links or hidden links are acceptable for a submission is a decision for the journal or institution; check the author instructions or thesis template you are working to. That is an editorial judgement, not a hyperref rule. See also manuscript format for journal submission.
Troubleshooting
Links appear as coloured boxes
That is the default (colorlinks=false). Set colorlinks=true for coloured text or hidelinks for none.
Options or other packages seem to be overridden
Move \usepackage{hyperref} to the end of your package list. The manual gives the reason as giving hyperref “a fighting chance of not being over-written”, and Overleaf likewise advises loading it last, with some exceptions.
A long URL runs off the line
hyperref has a breaklinks option that lets links break over lines by turning a multi-line link into PDF links to the same target. Overleaf lists its default as false. The manual is internally inconsistent about the default (false in one section, both in another), so set it explicitly if you rely on it.
PDF title and author are blank in the file properties
pdftitle and pdfauthor default to empty. Set them with \hypersetup after loading the package, because the manual notes LaTeX expands the values of these options prematurely otherwise. With pdfusetitle, hyperref tries to derive them from title and author.
Archival PDF/A requirements
The pdfa option (default false) “tries to avoid violations of PDF/A in code generated by hyperref”, but the manual says the result is usually not PDF/A because many features are not controlled by hyperref, and the option cannot be changed after hyperref is loaded. If a repository or journal requires PDF/A, validate the final file with a PDF/A checker rather than assuming the option is enough.
Free alternatives (table)
hyperref is a package, not a program, so the choice below is the editor you write in. See the linked guides for details on each.
| Option | Type | Guide |
|---|---|---|
| Overleaf | Browser-based LaTeX editor | What is Overleaf; alternatives to Overleaf |
| TeXstudio | Desktop LaTeX editor | TeXstudio guide |
| MacTeX | TeX distribution for macOS | MacTeX guide |
FAQ
How to do a link in LaTeX?
Load hyperref with \usepackage{hyperref}, then write \href{URL}{text} or \url{URL}.
How do I insert a clickable link?
The same two commands produce clickable links in the compiled PDF; the package must be loaded or the commands are undefined.
How do I create clickable hyperlinks in LaTeX?
Use \href for web or file targets, and \hyperlink/\hypertarget or \hyperref[label]{text} for places inside the document.
How to make a link blue in LaTeX?
Use \hypersetup{colorlinks=true, linkcolor=blue, urlcolor=blue, citecolor=blue}. hyperref draws boxes by default, so the colour options only change link text once colorlinks=true is set.
Sources (official docs)
- CTAN, hyperref package page: https://ctan.org/pkg/hyperref (checked 2026-11-07).
- hyperref manual (hyperref-doc): https://mirrors.ctan.org/macros/latex/contrib/hyperref/doc/hyperref-doc.html (checked 2026-11-07).
- Overleaf documentation, Hyperlinks: https://www.overleaf.com/learn/latex/Hyperlinks (checked 2026-11-07).







