The cash-and-stock deal would have created the world's biggest maker of confectionery.
Hershey turned down an initial offer of some £18bn from Mondelez in June.
Hershey’s shares plummeted by as much as 12% in late US trading on the news. Mondelez shares rose by almost 4%.
Irene Rosenfeld, chief executive at Mondelez, said: “The board is disappointed with the outcome but had decided there was no actionable path forward toward an agreement.
“Our proposal to acquire Hershey reflected our conviction that combining the two iconic American companies would create an industry leader with global scale in snacking and confectionery and a strong portfolio of complementary brands.”
The Cadbury owner has been financially active in the last few weeks after agreeing to buy the global licence for Cadbury-branded biscuits from Burton’s Biscuit Company for around £200m at the start of the month.