Hyperlinks in LaTeX: \href, \url and hyperref Setup
Load hyperref last in the preamble. Use \url for the address or \href for custom link text.
\usepackage{hyperref}
\href{https://example.com}{link text}The hyperref package turns cross-references, citations, and URLs into clickable links in your PDF. It's one of the most popular LaTeX packages and works with all standard document classes.
Load the hyperref Package
Add hyperref to your preamble. It should usually be one of the last packages loaded to avoid conflicts.
\usepackage{hyperref}
% With common options:
\usepackage[
colorlinks=true,
linkcolor=blue,
urlcolor=blue,
citecolor=green
]{hyperref}URL Links
Use \url{} for plain URLs or \href{}{} for links with custom display text:
% Plain URL (displays the full address)
Visit \url{https://www.trybibby.com} for more.
% Custom link text
Visit \href{https://www.bibby.ai}{Bibby AI} for more.
% URL with special characters (# _ %)
\url{https://example.com/path?key=value&foo=bar}Internal Cross-References
hyperref automatically makes \ref{} and \cite{} clickable. Use \hyperref for manual internal links:
\section{Introduction}
\label{sec:intro}
See Section~\ref{sec:methods} for details.
\section{Methods}
\label{sec:methods}
As mentioned in the \hyperref[sec:intro]{introduction}...Email Links
Use \href with the mailto: prefix to create clickable email addresses:
Contact us at \href{mailto:[email protected]}{[email protected]}.Customizing Link Appearance
Control link colors and borders with hyperref options:
\hypersetup{
colorlinks=true, % false = boxed links
linkcolor=black, % internal links
urlcolor=blue, % URL links
citecolor=blue, % citation links
filecolor=magenta, % file links
pdfauthor={Your Name},
pdftitle={Your Title},
bookmarks=true
}
% To hide all link colors (print-friendly):
\hypersetup{hidelinks}💡 Tips
- •Load hyperref last (or near-last) in your preamble to avoid conflicts
- •Use hidelinks for print versions so colored/boxed links don't appear
- •\autoref{label} produces 'Section 1' automatically instead of just '1'
- •For long URLs that break badly, add \usepackage{xurl} before hyperref
Try This in Bibby AI
Write LaTeX faster with AI auto-complete and instant compilation.
Start Writing FreeNeed help with your bibliography or citations?
Book a Free Call