A new type of diffractive optical code (DOC) using binary computer-generated hologram (BCGH) is presented. We introduce a new method of amplitude-compensated CGH to guarantee the DOC correctly decoded and to obtain higher signal-boise ratio. Compared with the phase-shaping method for diffractive optical bar code (DOBC), this DOC can yield substantially lower reconstruction error and higher efficiency. Computer simulation and optical experiment are reported.