Certain molecular switches respond to input stimulations producing detectable outputs. The interplay of these signals can be exploited to reproduce basic logic operations at the molecular level. The transition from simple logic gates to complex digital circuits requires the design of chemical systems able to process multiple inputs and outputs. We have identified a three-state molecular switch that responds to one chemical and two optical inputs producing two optical outputs. We have encoded binary digits in its inputs and outputs applying positive logic conventions and demonstrated that this chemical system converts three-digit input strings into two-digit output strings. The logic function executed by the three-state molecular switch is equivalent to that of a combinational logic circuit integrating two AND, two NOT, and one OR gate. The three states of the molecular switch are a colorless spiropyran, a purple trans-merocyanine, and its yellow-green protonated form. We have elucidated their structures by X-ray crystallography, (1)H NMR spectroscopy, COSY and NOE experiments, as well as density functional calculations. The three input stimulations controlling the interconversion of the three states of the molecular switch are ultraviolet light, visible light, and H(+). The two outputs are the absorption bands in the visible region of the two colored states of the molecular switch. We have monitored the switching processes and quantified the associated thermodynamic and kinetic parameters with the aid of (1)H NMR and visible absorption spectroscopies.