NASA is working on a viable way to create oxygen on Mars, and it's Mars Oxygen In-Situ Resource Utilization Experiment (MOXIE) is showing its worth by successfully converting Mars' toxic atmosphere into breathable oxygen.

Technicians in the clean room are carefully lowering the Mars Oxygen In-Situ Resource Utilization Experiment (MOXIE) instrument into the belly of the Perseverance rover, per NASA.
MOXIE is a relatively small instrument attached to NASA's Perseverance rover that is currently exploring the Jezero Crater in search of signs of ancient life. Perseverance landed in the Jezero Crater in February 2021, and since then, the MOXIE instrument has been converting Mars' carbon dioxide-rich atmosphere into breathable oxygen, with the small instrument creating as much as 0.2 ounces of oxygen per hour, which is about the same as a small tree.
The MOXIE instrument is run by researchers at the Massachusetts Institute of Technology (MIT), and according to members of the MOXIE team, they have already learned a large amount from the small amount of oxygen that the instrument has produced and that this new information will inform engineering in creating large-scale MOXIE's. Since Mars' atmosphere is about 96% carbon dioxide, MOXIE's will be essential to providing oxygen to colonists living on Mars' surface.
Engineers are essentially envisioning a MOXIE that is about 100 times larger than the one that is currently attached to the Perseverance rover.
"This is the first demonstration of actually using resources on the surface of another planetary body, and transforming them chemically into something that would be useful for a human mission. It's historic in that sense," said MOXIE deputy principal investigator Jeffrey Hoffman, a professor of the practice in MIT's Department of Aeronautics and Astronautics and a former NASA astronaut, in a statement.