Whitbread bought the chain back in 1995 when it was just made up of 39 outlets.
The deal still needs to get approval from shareholders and regulators, and is expected to be completed in the first half of 2019, the companies said.
Whitbread Plc agreed to sell Costa at a price that's 16 times this year's earnings before interest, taxes, depreciation and amortisation, the companies said in a statement on Friday. Costa's maroon shop front is now one of the most ubiquitous sights on British high streets, with 2,422 outlets in the United Kingdom and a further 1,399 in global markets, operated as franchises, joint ventures and wholesale outlets. But the Costa acquisition gives it a much bigger piece of the coffee market, which is growing by 6 percent a year, according to James Quincey, Coca-Cola president & CEO. It also operates almost 8,300 Costa vending machines worldwide.
"Hot beverages is one of the few remaining segments of the total beverage landscape where Coca-Cola does not have a global brand", Quincey said.
After missing out on the heady growth phase of coffee shops, Coca-Cola is entering when the market in countries like the United Kingdom and the U.S.is crowded.
PA Archive PA Images Costa also sells a range of coffee products in supermarkets
SodaStream makes machines that carbonate home tap water. She expects Coke to use the Costa name to create a range of ready-to-drink, cold-brew coffees.
"Coca-Cola are one of the few companies in the world that could justify the valuation", said Nicholas Hyett, equity analyst at Hargreaves Lansdown.
Doing so, Whitbread said, would "provide headroom" to expand Premier Inn in Britain and Germany.
Asked if Whitbread had been pressured to accelerate the sale by activist investor Elliott and other hedge funds, Chief Executive Alison Britain said no. The company will return most of the proceeds to its shareholders, it said.
Whitbread's share price was up nearly 16 per cent to £46.56 following the announcement, while London's benchmark FTSE 100 index on which it trades was down 0.3 per cent.