Objective: to estimate the prevalence and factors associated with lifetime HIV testing in non-injection drug users (NIDU). Methods: cross-sectional study was conducted with 323 individuals in clinics for chemical dependency of the state of Goiás, Central-West region of Brazil. Logistic regression analysis was used to identify factors associated with lifetime HIV testing. Results: The frequency of HIV testing was 48.9% (95% CI: 43.5-54.3%). HIV testing was associated with age, female gender, crack use, history of sexually transmitted infections, knowing people living with HIV/AIDS and/or someone who had died from AIDS, and having received some instruction on HIV/AIDS prevention methods. It was found that only 26.6% reported having access to the HIV rapid test. Conclusion: The determinants for HIV testing must be taken into account when planning prevention and programming strategies, including the widening of testing coverage among NIDU, educational health actions, links between sexually transmitted infections prevention services and addiction treatment services and the use of rapid tests to help people that are in contact with the virus learn about their HIV status, enter treatment, and improve their quality of life.