Under a draft law approved by the federal cabinet, the four firms – Vattenfall, EON, RWE and EnBW — will pay the money into a state fund for temporary and permanent nuclear waste storage by 2022.
Chancellor Angela Merkel declared the country would shut down all remaining nuclear plants by that date in the wake of Japan's 2011 Fukushima disaster.
Her decision has left ministers and power companies wrangling over shutdown and waste management costs ever since.
Beyond the €23.5 billion for waste management, the firms will remain financially and legally responsible for shutting down and dismantling the plants and preparing all remaining nuclear waste for permanent storage.
The remainder of a total €40 billion of provisions they have set aside to cover the nuclear phase-out is earmarked for those costs.
Eight nuclear power stations remain in operation in Germany.
Meanwhile, Berlin forecasts that investing the waste fund in financial assets will allow it to grow enough to cover the costs of temporary and permanent storage of the fuel remnants.
“Financing for shutdown, dismantling and waste management will be guaranteed for the long term without transferring the costs to society or endangering the economic situation of the operators,” energy minister Sigmar Gabriel said in a statement.
EON, which alone will contribute around €10 billion to the fund, also welcomed the deal.
But Germany has yet to identify a final site to store the nuclear waste.
An expert commission warned in July that even plans to open a facility by 2050 were “ambitious” given the delay in finding an appropriate location.
The search for and construction of a permanent storage site could take many decades, with the costs hard to calculate, critics of the deal have warned.
“The companies made high profits for years and shouldn't be released from overall responsibility,” energy policy expert Claudia Kemfert of the DIW economic think-tank said.
She added that the financially struggling energy companies may be unable to cover the costs of dismantling nuclear plants.
“With this pact only a fraction of the true costs will be covered, society will have to bear the rest,” she said.
Lawmakers in the German parliament still have to approve the law, which must also pass a European Commission check against state aid rules before coming into force.