Materials can be transformed from one crystalline phase to another by using an electric field to control ion transfer, in a process that can be harnessed in applications such as batteries, smart windows and fuel cells. Increasing the number of transferrable ion species and of accessible crystalline phases could in principle greatly enrich material functionality. However, studies have so far focused mainly on the evolution and control of single ionic species (for example, oxygen, hydrogen or lithium ions). Here we describe the reversible and non-volatile electric-field control of dual-ion (oxygen and hydrogen) phase transformations, with associated electrochromic and magnetoelectric effects. We show that controlling the insertion and extraction of oxygen and hydrogen ions independently of each other can direct reversible phase transformations among three different material phases: the perovskite SrCoO (ref. 12), the brownmillerite SrCoO (ref. 13), and a hitherto-unexplored phase, HSrCoO. By analysing the distinct optical absorption properties of these phases, we demonstrate selective manipulation of spectral transparency in the visible-light and infrared regions, revealing a dual-band electrochromic effect that could see application in smart windows. Moreover, the starkly different magnetic and electric properties of the three phases-HSrCoO is a weakly ferromagnetic insulator, SrCoO is a ferromagnetic metal, and SrCoO is an antiferromagnetic insulator-enable an unusual form of magnetoelectric coupling, allowing electric-field control of three different magnetic ground states. These findings open up opportunities for the electric-field control of multistate phase transformations with rich functionalities.