the best way to prevent it is to use a condom. If you have had unprotected sex or think you might be at risk of HIV, it's important to be tested.