Machine language, or machine code, is a low-level language comprised of binary digits (ones and zeros). High-level languages, such as Swift and C++ must be compiled into machine language before the code is run on a computer.
Since computers are digital devices, they only recognize binary data. Every program, video, image, and character of text is represented in binary. This binary data, or machine code, is processed as input by the CPU. The resulting output is sent to the operating system or an application, which displays the data visually. For example, the ASCII value for the letter "A" is 01000001 in machine code, but this data is displayed as "A" on the screen. An image may have thousands or even millions of binary values that determine the color of each pixel.
While machine code is comprised of 1s and 0s, different processor architectures use different machine code. For example, a PowerPC processor, which has a RISC architecture, requires different code than an Intel x86 processor, which has a CISC architecture. A compiler must compile high-level source code for the correct processor architecture in order for a program to run correctly.
Machine Language vs Assembly Language
Machine language and assembly language are both low-level languages, but machine code is below assembly in the hierarchy of computer languages. Assembly language includes human-readable commands, such as mov, add, and sub, while machine language does not contain any words or even letters. Some developers manually write assembly language to optimize a program, but they do not write machine code. Only developers who write software compilers need to worry about machine language.
NOTE: While machine code is technically comprised of binary data, it may also be represented in hexadecimal values. For example, the letter "Z," which is 01011010 in binary, may be displayed as 5A in hexadecimal code.
Updated: January 18, 2019