This paper proposes a compounded encoding and decoding algorithm based on the information-grayscale matrix. Generally, it is very difficult to track the original information in the circulation of commodity. This algorithm is aimed to be applied to product tracing, especially fast-moving consumer goods (FMCG). According to the traceability requirements of product information, we construct the structure of basic information code with information bits and check bits. The encoded information can be mapped into an information matrix through visible and invisible processes after extending the matrix, and we generate the corresponding grayscale matrix by calculating the relationship between the four-dimensional matrices of each matrix cell. It is the information-grayscale matrix that forms our product traceability information matrix. When the matrix is damaged in logistics transportation, we can get very high matrix information recovery rate through the decoding algorithm of the information-grayscale matrix including self-recovery, cross recovery, mutual recovery, and iteration; finally, the 2 × DA + DC structure can obtain 85% recovery rate when the damage rate reaches 70% for 10 million data volumes, and it can be extended into various structures. In addition, the algorithm can achieve a good balance between encoding rate and recovery rate and can be extended into different structures.