To assess the proportion of hospitalized patients who tested positive for human immunodeficiency virus (HIV) by a routine inpatient testing service, as recommended by the Centers for Disease Control and Prevention, who might not have been identified had routine testing not been offered. In this retrospective cohort study, the medical records of patients who tested HIV positive by the inpatient testing service between 1999 and 2003 were compared with the medical records of inpatients who tested HIV negative by the inpatient testing service and the medical records of patients who tested HIV positive in ambulatory settings. We compared HIV risk factors, discharge diagnoses, CD4 cell counts, and HIV RNA concentrations. A total of 243 patients participated in this study: 81 patients who tested HIV positive and 81 who tested HIV negative by the inpatient testing service, and 81 patients who tested HIV positive in ambulatory settings. Both HIV-positive inpatients and HIV-positive outpatients had similar frequencies of HIV risk factors (46% vs 43%; P=.75). Both groups differed significantly from HIV-negative inpatients (4%; P<.001). Comparing HIV-positive inpatients with HIV-positive outpatients, CD4 cell counts were lower (196 vs 371 cells/mm3; P<.001), and HIV RNA levels were higher (4.61 vs 4.09 Iog, HIV RNA; P=.001). At diagnosis, 64 HIV-positive inpatients (79%) met criteria for acquired immunodeficiency syndrome compared with 21 HIV-positive outpatients (26%) (P<.001). Patients who tested HIV positive through inpatient testing have more advanced disease than those identified as outpatients. Half of these patients would not have been identified had testing not been routinely offered. Routine inpatient HIV testing offers an important opportunity to identify patients with HIV infection.