An image encryption algorithm is proposed based on the combination of genetic (DNA) random coding and chaotic mapping. An image encryption algorithm based on an improved new four-dimensional chaotic system and DNA coding is proposed to address the problem that a single coding method is prone to selecting plaintext attacks. Based on a four-dimensional chaotic system existing in the literature, a new four-dimensional hyperchaotic system is obtained through improvement. The initial value of the system is generated based on SHA-256, zigzag transform. The input key and four pseudo-random chaotic sequences are generated iteratively. DNA chunking encoding, arithmetic operation, and decoding are implemented for the image disrupted based on the zigzag transform. The two-dimensional matrix constituted based on the Chaotic Sequence of Chebyshev to obtain the scrambled and diffused ciphertext image. Simulation experiments and security performance analysis show that the algorithm enhances the correlation between the key and the plaintext, the randomness of the encryption process, and effectively improves the anti-attack capability [H. Chen, J. Zhao et al., Appl. Res. Comput. 10, 0434 (2021)]. In this paper, 512 × 512 × 3 peppers color images are used for testing, and the correlation coefficients of adjacent pixels of the encrypted images are all close to 0, and the information entropy is all more significant than 7.997, which is relative to the theoretical value of 8. The experimental results show that the proposed algorithm improves the security of the ciphertext, increases the critical space, and, at the same time, resists various attack methods.