Identification of HIV remains a critical health priority for which emergency departments (EDs) are a central focus. The comparative cost-effectiveness of various HIV screening strategies in EDs remains largely unknown. The goal of this study was to compare programmatic costs and cost-effectiveness of nontargeted and 2 forms of targeted opt-out HIV screening in EDs using results from a multicenter, pragmatic randomized clinical trial. This economic evaluation was nested in the HIV Testing Using Enhanced Screening Techniques in Emergency Departments (TESTED) trial, a multicenter pragmatic clinical trial of different ED-based HIV screening strategies conducted from April 2014 through January 2016. Patients aged 16 years or older, with normal mental status and not critically ill, or not known to be living with HIV were randomized to 1 of 3 HIV opt-out screening approaches, including nontargeted, enhanced targeted, or traditional targeted, across 4 urban EDs in the United States. Each screening method was fully integrated into routine emergency care. Direct programmatic costs were determined using actual trial results, and time-motion assessment was used to estimate personnel activity costs. The primary outcome was newly diagnosed HIV. Total annualized ED programmatic costs by screening approach were calculated using dollars adjusted to 2023 as were costs per patient newly diagnosed with HIV. One-way and multiway sensitivity analyses were performed. The trial randomized 76,561 patient visits, resulting in 14,405 completed HIV tests, and 24 (0.2%) new diagnoses. Total annualized new diagnoses were 12.9, and total annualized costs for nontargeted, enhanced targeted, and traditional targeted screening were $111,861, $88,629, and $70,599, respectively. Within screening methods, costs per new HIV diagnoses were $20,809, $23,554, and $18,762, respectively. Enhanced targeted screening incurred higher costs but with similar annualized new cases detected compared with traditional targeted screening. Nontargeted screening yielded an incremental cost-effectiveness ratio of $25,586 when compared with traditional targeted screening. Results were most sensitive to HIV prevalence and costs of HIV tests. Nontargeted HIV screening was more costly than targeted screening largely due to an increased number of HIV tests performed. Each HIV screening strategy had similar within-strategy costs per new HIV diagnosis with traditional targeted screening yielding the lowest cost per new diagnosis. For settings with budget constraints or very low HIV prevalences, the traditional targeted approach may be preferred; however, given only a slightly higher cost per new HIV diagnosis, ED settings looking to detect the most new cases may prefer nontargeted screening.