Objective: To develop a resource allocation model to optimize health departments' Centers for Disease Control and Prevention (CDC)-funded HIV prevention budgets to prevent the most new cases of HIV infection and to evaluate the model's implementation in 4 health departments. Design, Settings, and Participants: We developed a linear programming model combined with a Bernoulli process model that allocated a fixed budget among HIV prevention interventions and risk subpopulations to maximize the number of new infections prevented. The model, which required epidemiologic, behavioral, budgetary, and programmatic data, was implemented in health departments in Philadelphia, Chicago, Alabama, and Nebraska. Main Outcome Measures: The optimal allocation of funds, the site-specific cost per case of HIV infection prevented rankings by intervention, and the expected number of HIV cases prevented. Results: The model suggested allocating funds to HIV testing and continuum-of-care interventions in all 4 health departments. The most cost-effective intervention for all sites was HIV testing in nonclinical settings for men who have sex with men, and the least cost-effective interventions were behavioral interventions for HIV-negative persons. The pilot sites required 3 to 4 months of technical assistance to develop data inputs and generate and interpret the results. Although the sites found the model easy to use in providing quantitative evidence for allocating HIV prevention resources, they criticized the exclusion of structural interventions and the use of the model to allocate only CDC funds. Conclusions: Resource allocation models have the potential to improve the allocation of limited HIV prevention resources and can be used as a decision-making guide for state and local health departments. Using such models may require substantial staff time and technical assistance. These model results emphasize the allocation of CDC funds toward testing and continuum-of-care interventions and populations at highest risk of HIV transmission.