The rapid development of technology today attracts a lot of attention from the wider community. The dynamic development of computers is accompanied by the ability to get information very quickly. Data compression is a technique to reduce the amount of data in the original data. Data compression is usually applied to computer machines. This happens because each symbol displayed on the computer has a different bit value. The large size of text files will be a problem for storage space. Because the need for text files is very important, we tend to collect data in the form of text files, and often without realizing it, we store it in large sizes. This causes the need for storage media to be large. To overcome this problem, text files that have a larger size are used by compressing text files. Large data will be compressed into a small size, which will reduce storage. After applying the comparison of the Shannon Fano Algorithm and the Stout Code algorithm, compressing the text file has proven that the text file has been successfully compressed. After performing the text file compression process, the author can conclude that the Shannon Fano algorithm is better at performing the compression process.