This question usually refers to how soon after exposure can someone test for HIV.
This usually requires waiting four weeks before taking an antibody-based test.
The latest UK guidelines state that 4th generation HIV tests (antigen/antibody) will detect 95% of infections four weeks after exposure.
A negative test after four weeks then needs to be confirmed with a second test three months after the risk. This is because some people take longer than four weeks to generate an antibody response.
In high risk exposures, especially if symptoms occur, viral load testing is sometimes used after one week.
This includes after a sexual assault or after a needlestick injury to a health care worker.
In these cases a viral load test can exclude an infection when there are symptoms.
Viral load tests are not approved to diagnose HIV. A negative result still needs to be confirmed by an antibody test three months after the risk.
Recommended time from exposure to HIV test