Merge BibTeX Files Online

Merge .bib files into one, with duplicates removed by key, DOI or title, key clashes fixed and nothing uploaded.

Combine .bib Files Into One Clean Bibliography

Duplicates found three ways

Entries are matched by citation key, by DOI, or by title and year, so the same paper is found even when two files give it different keys.

Key clashes resolved

When two different works share a key, the later one is renamed with a suffix. Every old key and new key is listed so you can update your \cite commands.

A report of every change

Removed duplicates, renamed keys, merged fields, @string conflicts and skipped entries are listed with file names and line numbers.

How to Merge BibTeX Files

Your original files stay unchanged; the merged file is a new download.

1

Add your .bib files

Choose or drop .bib, .bibtex or .txt files, paste BibTeX, or try the sample files.

2

Check each file and set the order

Each file shows its entries, parse errors, warnings and encoding. The order decides which copy counts as first.

3

Choose the merge settings

Pick the duplicate rules, what to do with duplicates and key clashes, the sort order and the formatting.

4

Merge and download

The output is parsed again and checked, then offered as a download with a preview and a report.

No files at hand? The sample BibTeX files page has .bib files you can download and merge as a test. More tools for bibliography files are on the BibTeX tools page.

Merge Settings Explained

Duplicate detection
Any mix of three rules: same citation key (case is ignored), same DOI (compared without https://doi.org/, doi: and braces), and same title and year (compared without braces, LaTeX commands and punctuation). The default is key plus DOI.
When duplicates are found
Keep the first copy, the last copy or the one with more fields. Merge fields keeps the first copy and adds fields that only the other copies have; it never overwrites a field, and each added field is listed.
Key clashes
For different works that share one key. Rename with a suffix adds a, b, c... to the later entries, skipping suffixes that are taken, and lists old and new keys. Or keep the first entry and drop the rest.
Sort
Keep file order, or sort by citation key, by first author's surname then year, by year with the newest first, or by entry type then key. Entries that tie keep their file order.
@string and @preamble
Keep all writes @preamble and @string blocks before the entries. Identical @string definitions are written once, and a name with different values is kept as it is and flagged. Drop them leaves both out.
Formatting
Keep original text writes each entry as it is in its file. Tidy rewrites all entries with lowercase type and field names, a two-space indent, one field per line and aligned equals signs. Braces stay braces and quotes stay quotes.
Comments
By default @comment blocks and free text between entries are left out. Keep @comment blocks writes them at the end of the file, which keeps JabRef group data.
Output filename and line ending
The file is named merged.bib unless you change it. Lines end with LF by default, or CRLF. Entries are separated by one blank line and the file ends with a line break.

Are My Files Uploaded?

No. Your browser reads each .bib file, parses it and builds the merged file on your device. There is no upload and no account, and nothing is kept after you close the page. That matters for unpublished reference lists, notes in annote fields and abstracts you are not free to share.

Will Merging Change My References?

Not with Keep original text, which is the default. Each kept entry is copied from @ to its closing brace exactly as it is in its file: field order, spacing, capitalisation, braces and LaTeX escapes stay the same. Only line endings are made uniform. Two things are rewritten. When a key is renamed, the key is replaced and the rest of the entry is left alone. When Merge fields adds fields to an entry, that one entry is written again with one field per line. Text between entries is not copied, and Tidy rewrites the layout of every entry but never the values.

Frequently Asked Questions

Complete Guide to Merging BibTeX Files

What a .bib File Contains

A .bib file is a plain text database of references for BibTeX or biblatex. Each reference is one entry. An entry starts with @ and an entry type such as article, book, inproceedings, phdthesis or misc. Inside the braces comes the citation key, which is the name you write in \cite{...}, and then a list of fields in the form name = value, separated by commas.

BibTeXthesis.bib
@string{jmr = "Journal of Meridian Research"}

@article{halvorsen2019tidal,
  author  = {Halvorsen, Ingrid and Mart{\'i}nez, Jo{\~a}o},
  title   = {Tidal Mixing in Narrow Fjords: A Field Study},
  journal = jmr,
  year    = 2019,
  month   = mar # "~14",
  doi     = {10.5555/jmr.2019.0421}
}

A value can be wrapped in braces, wrapped in double quotes, or be a bare number. It can also be a macro: a short name defined once with @string and reused, like jmr above. The # sign joins parts, so mar # "~14" becomes March~14. Entry types and field names are not case-sensitive. Two more block types exist: @preamble holds LaTeX code for the bibliography, and @comment holds text that BibTeX ignores. Anything outside an entry is also ignored.

Why Bibliographies Get Split and Duplicated

Few people keep one reference file for their whole career. The usual reasons you end up needing to merge bib files are:

  • Co-authors. Each author of a paper brings a .bib file, and the files overlap because you all cite the same core literature.
  • Exports from different managers. Zotero, Mendeley, JabRef and Google Scholar each write their own key style, so one paper appears as smith2020, Smith2020a and smith_deep_2020.
  • Old projects. A thesis reuses the files from three earlier papers, and each of those was a copy of an older file with a few additions.

The result is several files that share many entries. LaTeX can read them side by side, but repeated keys cause errors and the same paper can be printed twice in the reference list.

The Three Kinds of Duplicates

  • Same key. Two files contain halvorsen2019tidal. This is the only kind BibTeX itself notices, and it reports it as a repeated entry.
  • Same DOI, different key. The paper is the same but each file names it differently. A DOI identifies one published work, so matching on it is reliable. The DOI has to be normalised first: https://doi.org/10.5555/ABC and 10.5555/abc are the same DOI.
  • Same title and year, no DOI. Books, theses and older articles often have no DOI. Their titles differ in braces, capitals and punctuation, so the comparison has to ignore those.

Matching on keys alone misses the second and third kind. It also makes the opposite mistake: two different papers by the same author in the same year often get the same key, such as garcia2020. Removing one of them as a duplicate would lose a reference. The BibTeX Merger treats that case as a key clash and renames the later entry to garcia2020a.

Merging by Hand in a Text Editor

For two short files, copy and paste works. Open both, paste one under the other, then search for each key to find repeats. The risks grow with the size of the files. It is easy to delete the more complete copy of an entry, to cut an entry in the middle and leave an unbalanced brace, or to miss a duplicate that uses another key. An editor also does not tell you when two @string definitions disagree. If your files hold notes instead of references, the TXT Merger and the Markdown Merger join plain text and Markdown files, and Merge Word Files joins .docx chapters.

Merging With Command-Line Tools

cat, awk and Get-Content

Because text outside entries is ignored, you can combine bib files by writing one after another. These commands do that and nothing else: they do not remove duplicates, check syntax or convert encodings.

Bashterminal
# Linux and macOS: join the files, with a line break after each one
awk 1 thesis.bib paper.bib coauthor.bib > merged.bib

# cat does the same when every file ends with a line break
cat thesis.bib paper.bib coauthor.bib > merged.bib
PowerShellmerge.ps1
# Reads the files line by line and writes UTF-8.
# PowerShell 7 writes no byte order mark; Windows PowerShell 5.1 adds one.
Get-Content thesis.bib, paper.bib, coauthor.bib -Encoding utf8 |
  Set-Content merged.bib -Encoding utf8

BibTool

BibTool is a command-line program for sorting and cleaning BibTeX files. It reads several input files and writes one output file. With -s it sorts the entries, and with -d it checks for double entries, which it finds by comparing sort keys. By default the sort key is the citation key, so it does not match the same paper under two keys unless you configure a different sort format.

Bashterminal
# Read several files, sort by key (-s), check for double entries (-d)
bibtool -s -d thesis.bib paper.bib coauthor.bib -o merged.bib

# Also delete the double entries instead of only reporting them
bibtool -s -d -- 'check.double.delete = on' thesis.bib paper.bib -o merged.bib

bibtex-tidy

bibtex-tidy is a formatter that runs under Node.js. It can find duplicates by key, DOI, citation or abstract and merge them. It works on a single file and reformats every entry, so join the files first and keep a copy of the originals. Run npx bibtex-tidy --help to see the options in your version.

Bashterminal
# bibtex-tidy works on one file, so join the files first
cat thesis.bib paper.bib coauthor.bib > merged.bib

# Merge entries that share a key or a DOI. The file is rewritten in place.
npx bibtex-tidy --duplicates=key,doi --merge=combine merged.bib

You can also skip the merge and load both files in LaTeX. This is fine when the files do not overlap; it does not remove duplicates.

LaTeXmain.tex
% BibTeX: several files, no merge needed
\bibliography{thesis,paper}

% biblatex: one line per file
\addbibresource{thesis.bib}
\addbibresource{paper.bib}

A Reference Manager or This Tool

JabRef is a free desktop reference manager that stores its library as a .bib file. You can import a second file into the open library and then run its find duplicates command, which shows each suspected pair side by side and lets you choose what to keep. That is the best route when you want to review every pair by eye, or when you already manage your library in JabRef.

The browser tool fits a different job: merge bibtex files in one pass, with rules you set once, on any computer, with nothing to install. It does not ask about each pair. Instead it applies the rules and writes a report of every removed, renamed and skipped entry, so you can check the decisions afterwards. It also keeps the original text of your entries, where a reference manager usually rewrites the whole file in its own style. To try it without your own data, download test files from the sample BibTeX files page; other formats are on the sample files page.

What to Do After a Merge

  • Compile. Point your document at the merged file and run LaTeX, then BibTeX or Biber, then LaTeX twice.
  • Check for undefined citations. Search the log for "Citation ... undefined". Each one is a key that no longer exists, usually because the duplicate you cited was removed in favour of a copy with another key.
  • Fix renamed keys. Open the report, find each old key and new key, and update the \cite commands that meant the renamed entry.
  • Look at @string conflicts. If the report lists a macro with two values, decide which one is right and delete the other definition.
  • Keep the report. Save the .txt report next to the merged file so co-authors can see what changed.

Troubleshooting Common Parse Errors

The tool lists each problem with its file name and line number. An entry with a syntax error is skipped, and the entries after it are still read.

ProblemCauseFix
Unbalanced braces: a { is never closedA closing brace is missing in a title or abstract, so the value runs into the next field or the next entry.Go to the line in the message and count the braces in that field. The tool skips only this entry and continues at the next line that starts with @.
Missing comma after a fieldTwo fields follow each other with no comma between them. This happens often after pasting a field by hand.Add a comma at the end of the earlier field. A comma after the last field is allowed, so you can end every field with one.
Missing citation keyThe entry starts with a field, as in @article{title = ..., so there is nothing to cite.Add a key and a comma right after the opening brace.
Unterminated stringA value starts with a double quote that is never closed, or a quote inside a quoted value is not wrapped in braces.Close the quote, or write a quote inside the value as {"}. Using braces around the whole value avoids the problem.
An @ in an abstract or an email addressInside a braced value an @ is harmless. In free text between entries, an @ followed by a word and a brace is read as the start of an entry.Keep notes that contain @ inside a field or inside an @comment block.
Accented letters show as wrong charactersThe file was saved in one encoding and read in another, for example Latin-1 text read as UTF-8 by an editor.Check the encoding label on the file row. The tool reads invalid UTF-8 as Windows-1252 and writes UTF-8. LaTeX escapes such as {\"u} are never affected.

To find a reported line in a very large .bib file, the Large Text File Viewer jumps to a line number without loading the whole file. The same idea of merging with duplicate removal is available for other formats: the JSONL Merger for JSON Lines, the JSON merger for JSON files, and the VCF Duplicate Remover for contact files. All bibliography tools are listed on the BibTeX tools page.

Continue working with your documents

Get test files, see more BibTeX tools, or merge the other text files in your project.