The treasury department said the two banks would between them have to sell off businesses equating to 10 per cent of the UK retail banking market, and had agreed to curb bonus payments.
RBS, which is 70 per cent owned by the government, said in a statement that it would sell its RBS branches in England and Wales, and NatWest branches in Scotland, as well as its Churchill and Direct Line insurance division and parts of its investment banking arm.
"I believe today marks a key milestone in the radical restructuring we are undertaking to bring RBS back to stand-alone strength,'' Stephen Hester, the RBS chief executive, said.
Lloyds Banking Group said it would dispose of its TSB brand, Scottish TSB
branches and some other TSB branches in England and Wales.
"UK consumers will in theory enjoy increased choice and lower pricing, while rivals such as HSBC will be glad to see their rivals paying for their mistakes"
It will also sell the branches, savings accounts and branch-based mortgages of its Cheltenham & Gloucester unit.
Lloyds said it would raise $34.3bn through a record issue and debt swap, and pay a $4.1bn fee for avoiding the government's Asset Protection Scheme (APS), designed to insure its riskier loans.
"Lloyds will not participate in the APS and instead will raise additional private sector capital and pay a fee to the taxpayer for the implicit protection provided to date," the treasury said.
"This will reduce the risk borne by the taxpayer, improving value for money."
The government said it would maintain its 43 per cent stake in Lloyds.
"The news is potentially good for both UK consumers and rival banking groups, although more debatable for both Lloyds and RBS shareholders," Keith Bowman, an analyst at Hargreaves Lansdown Stockbrokers, said.
"UK consumers will in theory enjoy increased choice and lower pricing, while rivals such as HSBC will be glad to see their rivals paying for their mistakes."
The treasury department said it had reached agreement "in principle" with Neelie Kroes, the EU competition commissioner, over the restructuring.