The positive predictive value of an infective endocarditis diagnosis is approximately 80% in the Danish National Patient Registry. However, since infective endocarditis is a heterogeneous disease implying long-term intravenous treatment, we hypothesiszed that the positive predictive value varies by length of hospital stay. A total of 100 patients with first-time infective endocarditis in the Danish National Patient Registry were identified from January 2010 – December 2012 at the University hospital of Aarhus and regional hospitals of Herning and Randers. Medical records were reviewed. We calculated the positive predictive value according to admission length, and separately for patients with a cardiac implantable electronic device and a prosthetic heart valve using the Wilson score method. Among the 92 medical records available for review, the majority of the patients had admission length ⩾2 weeks. The positive predictive value increased with length of admission. In patients with admission length <2 weeks the positive predictive value was 65% while it was 90% for admission length ⩾2 weeks. The positive predictive value was 81% for patients with a cardiac implantable electronic device and 87% for patients with a prosthetic valve. The positive predictive value of the infective endocarditis diagnosis in the Danish National Patient Registry is high for patients with admission length ⩾2 weeks. Using this algorithm, the Danish National Patient Registry provides a valid source for identifying infective endocarditis for research.