Treatment of AIDS still faces multiple challenges such as drug resistance and HIV eradication. Development of new, effective and affordable drugs against HIV is urgently needed. In this study, we developed a world's first web server called Anti-HIV-Predictor (http://bsb.kiz.ac.cn:70/hivpre) for predicting anti-HIV activity of given compounds. This machine learning based web server is rapid and accurate (accuracy >93% and AUC > 0.958), which enables us to screen tens of millions of compounds and discover new anti-HIV agents. We firstly applied the server to screen 1835 approved drugs for anti-HIV therapy. Then the predicted new anti-HIV compounds were experimentally evaluated. Finally, we repurposed 7 approved drugs (cetrorelix, dalbavancin, daunorubicin, doxorubicin, epirubicin, idarubicin and valrubicin) as new anti-HIV agents. The original indication of these drugs is involved in a variety of diseases such as female infertility, acute bacterial infections, leukemia and other cancers. Anti-HIV-Predictor and the 7 repurposed anti-HIV agents provided here demonstrate the efficacy of this strategy for discovery of new anti-HIV agents. This strategy and the server should significantly advance current anti-HIV research.