The man was out having drinks with friends on Friday night in town of Ventron, Vosges, when he inhaled the gas.
Prosecutor Etienne Manteaux said that the victim inhaled the gas at around 2.30am via a balloon that he had inflated with a canister.
The nitrous oxide is in liquid form in the canister at a temperature of around -50C, and the man didn't wait for it to warm to room temperature before inhaling, said Manteaux.
"He began to laugh after inhalation but then immediately fell backwards and went into convulsions," Manteaux told local Vosges Matin newspaper.
Paramedics who rushed to the scene were unable to revive the man. He died of pulmonary edema, due to the excess fluid in his lungs.
Story continues below…
The prosecutor concluded that the man's death was "obviously linked to the consumption of nitrous oxide", even though there was also alcohol and marijuana consumed at the party.
Police are waiting for the results of a forensic analysis, which is expected to come through within weeks.