BWA-MEM is a new alignment algorithm designed for aligning sequence reads or assembly contigs against large reference genomes, such as the human genome. It automatically selects between local and end-to-end alignments, supports paired-end reads, and performs chimeric alignment. The algorithm is robust to sequencing errors and can handle sequence lengths from 70bp to a few megabases. For 100bp sequences, BWA-MEM outperforms several state-of-the-art read aligners. The algorithm uses a seed-and-extend paradigm, with re-seeding to reduce mismappings, chaining and chain filtering to manage seeds, and seed extension with a banded affine-gap-penalty dynamic programming approach. It also includes methods for paired-end mapping, such as rescuing missing hits and pairing based on alignment scores, insert size, and the possibility of chimeric read pairs. BWA-MEM is available as part of the BWA tool and has been evaluated on simulated data, showing high accuracy and speed, especially for longer reads. It is one of the few aligners that work well for both short and long sequences.BWA-MEM is a new alignment algorithm designed for aligning sequence reads or assembly contigs against large reference genomes, such as the human genome. It automatically selects between local and end-to-end alignments, supports paired-end reads, and performs chimeric alignment. The algorithm is robust to sequencing errors and can handle sequence lengths from 70bp to a few megabases. For 100bp sequences, BWA-MEM outperforms several state-of-the-art read aligners. The algorithm uses a seed-and-extend paradigm, with re-seeding to reduce mismappings, chaining and chain filtering to manage seeds, and seed extension with a banded affine-gap-penalty dynamic programming approach. It also includes methods for paired-end mapping, such as rescuing missing hits and pairing based on alignment scores, insert size, and the possibility of chimeric read pairs. BWA-MEM is available as part of the BWA tool and has been evaluated on simulated data, showing high accuracy and speed, especially for longer reads. It is one of the few aligners that work well for both short and long sequences.