Documentation/Citations & Bibliography/How to Add URLs and DOIs to BibTeX Entries
Citations & Bibliography

How to Add URLs and DOIs to BibTeX Entries

Modern academic references often include URLs and DOIs (Digital Object Identifiers) to help readers find the cited work. Adding these to your BibTeX entries requires the right fields and packages. Bibby AI automatically formats URLs and DOIs as clickable hyperlinks in your compiled PDF, and its citation tools help you find the correct DOI for any reference.

Add URL and DOI Fields to BibTeX Entries

Use the url and doi fields in your .bib file. The doi field should contain only the DOI identifier, not the full URL:

% In your .bib file:
@article{smith2024deep,
    author  = {Smith, John and Lee, Sarah},
    title   = {Deep Learning for Natural Language Processing},
    journal = {Journal of Machine Learning Research},
    year    = {2024},
    volume  = {25},
    pages   = {1--42},
    doi     = {10.1234/jmlr.2024.001},
    url     = {https://jmlr.org/papers/v25/smith24a.html}
}

@misc{brown2023api,
    author       = {Brown, Emily},
    title        = {REST API Design Best Practices},
    year         = {2023},
    howpublished = {\url{https://example.com/api-guide}},
    note         = {Accessed: 2024-06-15},
    url          = {https://example.com/api-guide}
}

@inproceedings{chen2024transformer,
    author    = {Chen, Wei and Zhang, Li},
    title     = {Efficient Transformers for Long Documents},
    booktitle = {Proceedings of ACL 2024},
    year      = {2024},
    doi       = {10.18653/v1/2024.acl-main.123}
}

Set Up Packages for Clickable Links

Load the hyperref and optionally the doi package in your preamble to render URLs and DOIs as clickable hyperlinks in the PDF:

% In your preamble:
\usepackage{hyperref}
\hypersetup{
    colorlinks=true,
    linkcolor=blue,
    citecolor=blue,
    urlcolor=blue
}

% Optional: The doi package formats DOIs consistently
\usepackage{doi}

% For biblatex users — URL and DOI display is built-in:
\usepackage[backend=biber, style=numeric, url=true, doi=true]{biblatex}
\addbibresource{references.bib}

% For natbib users — add URL support:
\usepackage{natbib}
\usepackage{url}  % Provides \url{} command for line-breakable URLs

% To break long URLs at good points:
\usepackage[hyphens]{url}
\urlstyle{same}  % Use the same font as surrounding text

Control Which Fields Appear in the Bibliography

You may not always want URLs or DOIs displayed. Here's how to control their visibility:

% With biblatex — hide URLs but show DOIs:
\usepackage[backend=biber, style=numeric, url=false, doi=true]{biblatex}
\addbibresource{references.bib}

% Or selectively hide URL for entries that have a DOI:
\DeclareSourcemap{
    \maps[datatype=bibtex]{
        \map{
            \step[fieldsource=doi, final]
            \step[fieldset=url, null]
            \step[fieldset=urldate, null]
        }
    }
}

% With natbib/BibTeX — the .bst file controls what's displayed.
% Some .bst files support url/doi fields, others don't.
% Use plainurl.bst or unsrturl.bst for URL support:
\bibliographystyle{unsrturl}
\bibliography{references}

% If your .bst doesn't support url, use the note field as a fallback:
@misc{website2024,
    author = {Mozilla},
    title  = {MDN Web Docs},
    year   = {2024},
    note   = {\url{https://developer.mozilla.org}. Accessed: 2024-06-15}
}

💡 Tips

  • Always use the doi field for DOIs (e.g., 10.1234/example) — don't put the full https://doi.org/ URL in the doi field.
  • Load the url package with [hyphens] to allow URLs to break at hyphens, preventing overflow into the margin.
  • Use \urlstyle{same} to match URL font to the surrounding text rather than switching to monospace.
  • Bibby AI's citation finder automatically includes DOIs when adding references, saving you from looking them up manually.

Try This in Bibby AI

Write LaTeX faster with AI auto-complete and instant compilation.

Start Writing Free

Related Tutorials

How to Add URLs and DOIs to BibTeX Entries | Bibby AI