The American director's romantic comedy was filmed in the French capital last year and stars Owen Wilson, Rachel McAdams, Marion Cotillard, Kathy Bates, Adrien Brody and Carla Bruni-Sarkozy.
Festival director Thierry Frémaux said: "Midnight In Paris is a wonderful love letter to Paris. It’s a film in which Woody Allen takes a deeper look at the issues raised in his last films: our relationship with history, art, pleasure and life. His 41st feature reveals once again his inspiration."
Allen's third London-set film You Will Meet A Tall Dark Stranger screened at last year's festival.
The 64th Cannes Film Festival runs from May 11 to May 22.