How to convert a DOI to a BibTeX file

DOI (Digital Object Identifier) are permanent identifiers for documents such as academic papers. A convenient way to quickly store a bibliography is to keep a list of DOI. Then there exist some web services to convert a DOI link to a bib file. For example, you can copy-paste your DOI on the website If you want to download the bib file from a script or a program, the website provides an API. Simply query the URL:<DOI>

by replacing <DOI> by the corresponding DOI and the output will be a file in bib format.

For instance, for, the output should be:

	doi = {10.1007/978-1-4684-2001-2_9},
	url = {},
	year = 1972,
	publisher = {Springer {US}},
	pages = {85--103},
	author = {Richard M. Karp},
	title = {Reducibility among Combinatorial Problems},
	booktitle = {Complexity of Computer Computations}

The website also provides such an API. Assuming that the DOI is stored in the variable $doi, you can call the API from the Linux shell as follows:

wget --header="Accept: application/x-bibtex; charset=utf-8" -qO- "$doi"

Or, if you prefer cURL:

curl -LH "Accept: application/x-bibtex; charset=utf-8" "$doi"

I have written the following script to generate a bib file from one DOI or a list of DOIs.

if test -t 0
then input="$@"
else input="$@ `cat`"
for ref in $input
doi=`echo $ref | sed -e "s/^\(\(https\?:\/\/\)\?\(dx.\)\?\/\|doi:\)//"`
wget --header="Accept: application/x-bibtex; charset=utf-8" -qO- "$doi"

Assume that you saved the script in the file, it can be called as follows:

./ <DOI_list...>

Or, using a pipe, for example:

cat <file_with_DOIs> | ./

If you only need a citation in plain text format with the formatting style of your choice, the website should fit your needs. The website also provides this service as an API:

wget --header="Accept: text/x-bibliography; style=$style" -qO- "$doi"

where $doi is the DOI and $style is the formatting style (apa, elsevier-harvard, ...).