The reversible photoswitching between an anthracene derivative and its [4+4] dimer, using the template effect of the CB8 macrocycle, was demonstrated. This example of supramolecular chemistry in water was harnessed to demonstrate the operation of a keypad lock device that is driven by means of light and chemicals as inputs.The use of molecular species for achieving information processing of chemical, photonic or electrochemical signals according to the principles of binary coding (0 and 1) and Boolean language continues to receive wide attention. [1][2][3] The challenge of achieving the design of molecules that are capable of a predetermined logic operation has received important backup from smart applications of molecular logic gates in sensing, drug delivery, theranostics, and materials chemistry. [4][5][6][7][8][9][10] Among the different logic operations, those that imply a memory function belong to the most demanding ones in terms of their chemical design. 11 This type of logic, known as sequential logic, results in differentiated outputs depending on the input history of the device. Current research activities along these lines have their focus on the implementation of flip-flops and molecular keypad locks. Photochromic switches have been often exploited for these purposes. [12][13][14][15] However, chemically-addressable systems and redox-switchable molecular devices were also used for the demonstration of molecular keypad locks [16][17][18][19] and flip-flops. 20,21 Surprisingly, the exploitation of supramolecular host-guest phenomena for the demonstration of keypad lock functions has no precedence in the literature. In recent reports host-guest complexes with cucurbit [7]uril (CB7) and cucurbit [8]uril (CB8) were used to demonstrate the reconfigurable and resettable operation of logic gates in aqueous solution. 22,23 Cucurbiturils have drawn much attention for their very high binding constants of cationic guests (up to 10 17 M À1 ) 24 and their supramolecular application potential with a strong focus on biological and pharmacological contexts, and analytical problems is beginning to reveal. [25][26][27][28][29][30][31][32][33][34][35] In the present work we take advantage of the specific complexation properties of the CB8 macrocycle. Unlike the smaller homologues CB6 and CB7, that commonly offer space for only one guest molecule, the larger CB8 often accommodates two guests and the resulting complexes may feature new emission properties (e.g., excimer fluorescence) or lead to fluorescence self-quenching. [35][36][37][38] Additionally, the resulting pre-organization of the two guests may facilitate intracomplex photoreactions that would not happen at the dilute concentrations of the free dye molecules. [38][39][40] In a wider context, host-templated photodimerizations have been used in the design of photoswitchable supramolecular polymers. [40][41][42] Herein we designed the anthracene derivative 1 (see the ESI † for details of the synthesis and Scheme 1 for the structure) which contains a positively ...