How to Add a LaTeX Hyperlink
To add a LaTeX hyperlink, load the hyperref package and write \href{URL}{link text}. To show the address itself as the link, use \url{URL}. Both become clickable in the PDF.
Read the \href{https://www.latex-project.org}{LaTeX Project site},
download packages from \url{https://ctan.org}, or
\href{mailto:[email protected]}{send an email}.Needs \usepackage[colorlinks]{hyperref} in the preamble.
Full document you can compile
\documentclass{article}
\usepackage[colorlinks]{hyperref}
\begin{document}
Read the \href{https://www.latex-project.org}{LaTeX Project site},
download packages from \url{https://ctan.org}, or
\href{mailto:[email protected]}{send an email}.
\end{document}Why are my links in red boxes?
That is the hyperref default: a red frame around internal links and a cyan one around web links. The frames show only on screen and are not printed. Load the package as \usepackage[colorlinks]{hyperref} to color the link text instead, as in the examples here, or with [hidelinks] to make links look like normal text.
How do you change the color of a LaTeX hyperlink?
Use \hypersetup after loading the package. linkcolor sets internal links, urlcolor web links and citecolor citations; any xcolor color works.
\hypersetup{colorlinks=true, linkcolor=blue!60!black, urlcolor=teal}
See \href{https://ctan.org/pkg/hyperref}{the hyperref manual}.Needs \usepackage{xcolor}, \usepackage{hyperref} in the preamble.
Full document you can compile
\documentclass{article}
\usepackage{xcolor}
\usepackage{hyperref}
\begin{document}
\hypersetup{colorlinks=true, linkcolor=blue!60!black, urlcolor=teal}
See \href{https://ctan.org/pkg/hyperref}{the hyperref manual}.
\end{document}How do you link to a section in the same document?
Put \label{…} after the heading and refer to it with \ref{…}; with hyperref loaded, the number becomes a link. \autoref also writes the word, such as "Section 1", and makes it part of the link.
\section{Results}\label{sec:results}
The method is explained in Section~\ref{sec:results}
and again in \autoref{sec:results}.Needs \usepackage[colorlinks]{hyperref} in the preamble.
Full document you can compile
\documentclass{article}
\usepackage[colorlinks]{hyperref}
\begin{document}
\section{Results}\label{sec:results}
The method is explained in Section~\ref{sec:results}
and again in \autoref{sec:results}.
\end{document}Which characters cause trouble in a LaTeX hyperlink?
# and ~ can be typed as they are in \href and \url. A % must be written \%, or LaTeX reads the rest of the line as a comment. Inside the argument of another command, such as a footnote, escape # as \# too. The full list of characters LaTeX treats specially is in the special characters guide.
Where should hyperref go in the preamble?
Load it last, after the other packages, because it changes many of their commands. A few packages, such as cleveref, must come after it; their manuals say so.
How do you link to a citation or a figure?
Citations become links automatically once hyperref is loaded; the BibTeX citation guide sets them up. Labels on figures and tables work like section labels. To convert LaTeX to HTML, the converter turns \href and \url into ordinary <a> links.
Sources
- hyperref package manual (CTAN), read Nov 28, 2026
- LaTeX2e: An unofficial reference manual, \label and \ref, read Nov 28, 2026
Text drafted with AI from the hyperref manual; every example compiled with TeX Live 2026; checked by Cem Demir. See the editorial policy.