Many proteins have evolved the ability to recognize and bind to specific sequences of DNA. This specificity is quite high (>107 for the target sequence over random DNA) and often is the basis for genetic switches which can repress or induce transcription in cells. One of the best known DNA-binding proteins is the lac repressor protein which binds tightly to the lac operator but loses its affinity for this site upon the binding of lactose. We have used this lac repressor protein and the lac operator sequence to construct a binary molecular gate which can be positioned in the open or closed configuration by the addition or removal of the effector molecule lactose. The device is constructed of three DNA strands which form an elongated hairpin structure of two dsDNA arms with a 5 nt ssDNA hinge at one end, and two ssDNA regions on the opposite end. A fourth ssDNA molecule (the 'locking' strand), complementary to the two ssDNA regions, binds by complementary base pairing to seal the gate in the closed configuration. Addition of lac repressor protein to the device causes a displacement of the locking strand by binding to two lac operators embedded in the double-stranded hairpin structure. Binding of the proteins is rapid and sufficiently strong enough to cause a displacement of the locking strand, switching the gate into the open conformation. Addition of lactose (or IPTG) quickly causes a release of the lac repressor protein from the operators allowing the gate to be closed by the binding of the locking strand. The opening and closing of this binary gate was detected by gel shift assays and by fluorescence resonance energy transfer spectroscopy of two dyes located near the opening of this gate. The gate could be cycled repeatedly, responded uniquely to lactose, and may be useful as a device for moving or holding structures on a molecular scale.