Switching the magnetic state of a polycyclic conjugated hydrocarbon in a reversible and controlled manner is challenging. Now, by means of single-molecule scanning probe microscopy, an indenofluorene isomer on ultrathin NaCl films has been shown to adopt both open- and closed-shell states. Furthermore, bidirectional switching between the two states is achieved by changing the adsorption site of the molecule.