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.

LaTeX
Read the \href{https://www.latex-project.org}{LaTeX Project site},
download packages from \url{https://ctan.org}, or
\href{mailto:hello@example.com}{send an email}.
OutputA sentence with three colored links: LaTeX Project site, the address https://ctan.org, and send an email.

Needs \usepackage[colorlinks]{hyperref} in the preamble.

Full document you can compile
example.tex
\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:hello@example.com}{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.

LaTeX
\hypersetup{colorlinks=true, linkcolor=blue!60!black, urlcolor=teal}
See \href{https://ctan.org/pkg/hyperref}{the hyperref manual}.
OutputA sentence with a dark blue-teal link reading the hyperref manual.

Needs \usepackage{xcolor}, \usepackage{hyperref} in the preamble.

Full document you can compile
example.tex
\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.

LaTeX
\section{Results}\label{sec:results}
The method is explained in Section~\ref{sec:results}
and again in \autoref{sec:results}.
OutputA section titled 1 Results, then a sentence linking to Section 1 twice, once with ref and once with autoref.

Needs \usepackage[colorlinks]{hyperref} in the preamble.

Full document you can compile
example.tex
\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.

Text drafted with AI from the hyperref manual; every example compiled with TeX Live 2026; checked by Cem Demir. See the editorial policy.