We describe an optical security device that is the exclusive-OR (XOR) encryption. In the field of electronic ciphering, one such algorithm is the exclusive-OR encryption. This encryption technique can handle only binary signals and encrypts each pixel individually. Because images consist of pixel, we can use mask bit to encrypt it. The theoretical results are verified by computer simulation. Theoretical and computer simulation indicate that XOR encryption is a safe coding method.