The invention provides an error correction method of a memory and solves the problem that a conventional ECC (error correction code) encoding process cannot be smoothly performed to achieving encoding and a parity bit cannot be generated due to existing of a data mask, or a storage array area is required to be increased in order to generate the parity bit. The error correction method of the memory comprises the following steps: (1) external data are read in, the parity bit is generated according to a set rule, a characteristic bit is generated simultaneously, and the external data, the characteristic bit and the parity bit are stored in the memory; and (2) the external data, the characteristic bit and the parity bit in the memory are read out, if characteristic bit characterizes that the data mask (DM) exists, the parity bit is invalid, and decoding and error correction are not performed when the data are read out, and if characteristic bit characterizes that the DM dose not exists, the parity bit is valid, and decoding and error correction are performed by utilizing the parity bit when the data are read out. The error correction method of the memory can reduce the possibility for a DRAM (dynamic random access memory) to make errors, even for a system using the DM.