Network security has recently become a major issue since the growth of electronic data exchange so cryptography is important in protecting secure online data resources from integrity, confidentiality, and safety perspective against potential attacks such as eavesdropping and brute force. In this paper, we proposed a method for encrypting the transmitted information based on an image, which worked as a key that is saved by the client and the server. The encryption process of the text will be to encode characters by changing the ASCII code of characters with the locations (row and column) of the ASCII code equivalent in the image data, the locations will be chosen randomly. The proposed algorithm provides a relatively greater degree of security in avoiding avalanches, eavesdropping attacks, and password space because the character encoding method will be dynamic depending on the size and type of image used. Several securities analyses were presented, and the proposed algorithm proved to be highly secure. Compared to some current text cypher schemes, the proposed algorithm is very safe against modern cryptanalysis.