The prince walked into a sexual health clinic in Burrell Street, central London, to have the finger-prick test - for which he tested negative.
The 31-year-old has made raising awareness about HIV and Aids a major element of his public work.
There are more than 100,000 people living with HIV in the UK.
The prince had to wait only a few moments to get his results, while his blood sample was mixed with chemicals and poured into a test tray.
The negative result was indicated by a blue spot seen in the tray. However, if two spots had appeared he would have needed further tests to confirm if he was HIV-positive.
The procedure was carried out by Robert Palmer, a lead health adviser and psychosexual counsellor, who said the prince was "anxious".
Asked about the significance of a member of the Royal Family getting tested for HIV, Mr Palmer added: "It means this is a test for everybody - it doesn't matter who you are, it's a good idea to have an HIV test."
The average HIV prevalence in the UK - for those aged over 15 years old - is 1.9 per 1,000 population. However for gay men the rate jumps to 48.7 per 1,000. Black African women are the second most at-risk group with a prevalence rate of 43.7 per 1,000.
Latest figures from Public Health England in 2014 estimated 18,100 people were unaware of their infection and at risk of unknowingly passing on the virus.
Prince Harry has been tested for HIV in an effort to raise awareness about the condition and encourage others to get checked out.