A code is said to be an error-correcting, if the correct code word can always be deducted from an erroneous word. Hamming code is most suitable for error detection and correction for digital data. It facilitate error detection and correction in code information. Here 7 bit Hamming code convertor is proposed. In this code, to each group of m information bits, n parity checking bits are located at positions 2(n-1) from left are added to form an (m+n)-bit code word. Code convertor device is designed using Mach-Zehnder interferometer (MZI). MZI is an optical switch, able to transfer signal from one port to other.