The latest inflation rate was a further increase from 9.4 percent in June and beat economists' forecast of 9.8 percent. On a monthly basis, CPI also rose by 0.6 percent in July, compared with no change in July 2021.
"A wide range of price rises drove inflation up again this month. Food prices rose notably, particularly bakery products, dairy, meat and vegetables, which was also reflected in higher takeaway prices," said Grant Fitzner, ONS chief economist.
Prices for staple items such as pet food and deodorants, package holidays and airfares also rose. Data showed food and non-alcoholic beverage prices rose at an annual rate of 12.7 percent in July, up from 9.8 percent in June, while the annual growth rate for recreation and culture was 5.6 percent in July, up from 4.8 percent in June.
"The cost of both raw materials and goods leaving factories continued to rise, driven by the price of metals and food respectively," said Fitzner.
Earlier this month, the Bank of England (BoE), the country's central bank, expected inflation to continue rising to 13 percent in the fourth quarter of 2022, and to remain at very elevated levels throughout much of 2023.
To battle the soaring inflation, the BoE has raised interest rates six times in a row since December last year, bringing its benchmark interest rate to 1.75 percent, a 13-year-high.