How did Perseverance make oxygen on Mars?

MOXIE converts carbon dioxide from the atmosphere with electrochemistry.

Technicians at NASA's Jet Propulsion Laboratory lower the Mars Oxygen In-Situ Resource Utilization Experiment (MOXIE) instrument into the belly of the Perseverance rover. Credits: NASA/JPL-Caltech