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. A three-state molecular switch that responds to one chemical and two optical inputs producing two optical outputs was identified. The three states of the molecular switch were a colorless spiropyran, a purple trans-merocyanine and its yellow-green protonated form. Their structures were elucidated by X-ray crystallography, ‘H-NMR spectroscopy, COSY and NOE experiments. The switching processes were monitored and the associated thermodynamic and kinetic parameters quantified with the aid of ‘H-NMR and visible absorption spectroscopies. The system was analyzed with the aid of binary logic and it was found to execute the logic function equivalent to that of a combinational logic circuit integrating five logic gates. Different strategies to communicate chemical and optical signals between the three-state molecular switch and compatible molecular components were developed. Combinational as well as sequential logic functions were reproduced with ensembles of communicating molecules. Finally, the molecular switch was operated inside solid polymeric matrices.