What Is the Difference Between an ASCII File and a Binary File?

In computing, an ASCII file is a piece of data that is purely text-based and immediately viewable. In contrast, a binary file is a complex piece of data that requires specific instructions to decode the information.

All computer files are comprised of tiny pieces of information, called bits. In an ASCII file, each byte directly correlates to a specific character as defined by the standard ASCII code. A common example of an ASCII file is a text document created without any formatting, such as font styles or paragraph indentations. ASCII files are used for simple word editing, but they are also the basis for all web pages. HTML is written in ASCII because each character has a specific and unique meaning that can be easily read by web browsers.

Binary files are composed of a long series of the characters “1” and “0” in complex configurations. This differs from ASCII in that the characters can be used to create any kind of data, from text to images. A program, such as a web browser, uses the binary information coded within it to analyze an HTML ASCII file and translate that information into a visual web page. Pictures and program-specific files, such as a Photoshop document, are also considered to be binary files.