Queen Elizabeth II's funeral and events during the period of national mourning cost the government an estimated £162m, the Treasury has said.
The state funeral on 19 September 2022 came 11 days after her death.
During that period of national mourning hundreds of thousands of people visited Westminster where she was lying in state.
The Home Office (£74m) and Department of Culture, Media and Sport (£57m) spent the most.
The costs incurred by the government departments relate to the Queen's funeral and other events in the run-up, including the monarch's lying-in-state.
John Glen, chief secretary to the Treasury, said the government's priority at the time had been to make sure "these events ran smoothly and with the appropriate level of dignity, while at all times ensuring the safety and security of the public".
In a written ministerial statement made to Parliament, Mr Glen said the Treasury had provided additional funding where necessary and the Scottish, Welsh and Northern Ireland governments were "fully" refunded for their respective costs.
The estimated costs include:
* Department for Culture, Media & Sport - £57.42m
* Department for Transport - £2.565m
* Foreign, Commonwealth & Development Office - £2.096m
* Home Office - £73.68m
* Ministry of Defence - £2.890m
* Northern Ireland Office - £2.134m
* Scottish Government - £18.756m
* Welsh Government - £2.202m
* Total - £161.743m
After Queen Elizabeth II died on 8 September 2022 aged 96, the UK started 10 days of national mourning.
The late Queen's coffin was laid to rest in St Giles' Cathedral in Edinburgh for 24 hours, before the monarch was taken to Westminster Abbey in London where thousands of mourners queued for hours to pay their respects.
People lined up in London at all hours of the day, often in chilly temperatures, to pay their respects - including David Beckham.
The wait time at one stage was estimated to be more than 24 hours; and the queue snaked from Westminster Hall, down along the River Thames and stretched south for almost seven miles (11km).
The scale of the state funeral and mourning arrangements led to what police described at the time as "probably the biggest operation we're likely to launch in the UK".
World leaders and foreign royalty joined the Royal Family for the state funeral at Westminster Abbey.
Members of the 2,000-strong congregation included the Queen's great-grandchildren, the prime minister at the time Liz Truss and US President Joe Biden and his wife Jill.
The event was watched by millions of people across the country and around the world.
It was the first state funeral since Sir Winston Churchill's in 1965 and the biggest ceremonial event since World War Two.
After the funeral, the Queen's coffin travelled in a procession to Wellington Arch and then on to its final journey to Windsor Castle and a committal service.
The cost was used to facilitate the smooth running of the event and ensure mourners from the UK and across the world could visit and take part safely, Downing Street has said.
"Of course, a major international event of this scale, we wanted to ensure that we could enable people to pay their respects," a No 10 spokesman added.