The CPI figure had hit a five-year high of 3.1% in November, when the inflationary effect of the pound's fall following the June 2016 Brexit vote reached its peak.
As for year-on-year comparison, retail inflation had increased by 2.36 per cent in July last year.
On month-on-month basis, the headline index increased by 1.13 per cent in July 2018, down by 0.11 per cent points from 1.24 per cent recorded in June 2018; representing the first month on month headline inflation decline since February 2018.
The Cabinet Office says the impact of the GBP/EUR exchange rate which has been present during much of the previous 12 months has fallen away.
However, inflation in the "fuel and light" segment based on the changes in the CPI increased to 7.96 percent from 7.14 in the previous month.
Economic Affairs Secretary S C Garg said that all macroeconomic parameters are performing well.
"Based on this analysis, CPI inflation is set to return to the 2% target over the year ahead". "The deteriorating external situation could be a big factor that influences the MPC even as they closely watch the inflation trajectory going forward", he said. It is down from 5% in June.
United Kingdom inflation rose to 2.5% in July, after holding steady at 2.4% in the previous three months as the cost of transport and computer games increased.
He said a price war on the high street would bring inflation back down to 2% by the end of the year.
"These figures show that the cost of living squeeze is not yet a thing of the past", Tej Parikh, a senior economist at business lobbyist the Institute of Directors said in an email. A Reuters poll of economists had predicted the inflation to come at 4.51 per cent.
"Crude oil prices continue to display a volatile trend, driven by geopolitical risks and concerns regarding supply as well as demand in various parts of the world".
Consumer inflation was at 4.17 per cent in July, government data showed on Monday. Price data are received through web portals, maintained by the National Informatics Centre.