← New search

Other meanings of Machine code

COMPUTING · LOW-LEVEL SYSTEMS

Machine code

Machine code is the set of low-level computer instructions executed directly by a processor. It is expressed as bit patterns and byte sequences defined by an instruction-set architecture (ISA), rather than by human-oriented keywords or mathematical notation.

ISA-defined
Instruction format
Meaning depends on the processor architecture
Binary-oriented
Representation
Usually stored and transmitted as bytes
Processor-specific
Portability
Code for one ISA may not run on another
1

Definition and role

Machine code is the processor-specific representation of operations such as loading data, adding values, comparing conditions, and changing the program counter. Each instruction is encoded according to an ISA, which specifies available operations, registers, operand formats, memory rules, and instruction lengths.1 A sequence of these encodings forms an executable program, although a complete executable also normally includes metadata, data, libraries, and an operating-system-specific file format.

Machine code is distinct from source code and assembly language. Source code uses abstractions such as functions and loops; assembly language gives symbolic names to instructions and registers; machine code contains the numeric encodings that the processor fetches and decodes. The same source or assembly operation can therefore produce different machine code for x86-64, ARM64, RISC-V, or another architecture.2

2

How processors execute it

A processor executes machine code through a recurring sequence of instruction fetch, decode, operand access, execution, and retirement, though modern designs overlap these stages through pipelining and speculative execution. The instruction pointer identifies the next location to fetch, while registers and memory provide operands and receive results. Conditional branches alter the normal sequence by selecting a different address.

The visible instruction set does not always reveal the processor's internal implementation. Some complex instructions may be translated into simpler internal operations, and an instruction's latency or throughput can vary by microarchitecture even when its encoded meaning remains stable.3 Privilege levels, virtual memory, interrupts, and protection mechanisms also affect whether a machine-code instruction is permitted and what state it can change.

3

From programs to executable bytes

Compilers and assemblers turn human-readable programs into machine code, while linkers combine separately compiled pieces and resolve addresses or library references. A compiler may emit assembly as an intermediate text form, or generate object-code sections more directly; an assembler then converts instruction mnemonics into the target ISA's encodings. Linkers and loaders can leave some addresses for relocation when a program is placed in memory.

Disassemblers perform the reverse presentation: they interpret bytes as instructions and display mnemonics, registers, and operands. The result is not always unique or complete, because data can be interleaved with code, variable-length ISAs can admit multiple boundaries, and indirect branches obscure control flow. Debugging information, symbol tables, and executable formats such as ELF or PE help tools interpret the bytes but are not themselves machine instructions.45

4

Lesser-known aspects

Machine code is not universally “raw binary” in the narrow sense of a file containing only instruction bytes. An executable may contain headers, alignment padding, relocation records, exception metadata, signatures, and embedded constants alongside code. Some instructions read from memory or invoke operating-system services, so identical bytes can behave differently when privilege, address mapping, device state, or available extensions differ.

Portability has several layers. Code compiled for the same ISA may still depend on a particular operating-system ABI, calling convention, binary format, or optional instruction extension. Conversely, a virtual machine or emulator can execute machine code intended for another processor by translating or simulating its instructions. Security researchers also study machine-code properties such as return-oriented programming, code signing, control-flow integrity, and speculative-execution effects, showing that the bytes are both a computational representation and an object of analysis.36

Glossary

Instruction-set architecture (ISA)
The specification defining a processor's programmer-visible instructions, registers, data types, memory behavior, and encoding rules.
Assembly language
A symbolic, human-readable notation for machine instructions, usually translated by an assembler.
Opcode
The encoded field or bit pattern identifying the operation an instruction performs.
Disassembler
A tool that translates machine-code bytes into an assembly-language representation.
ABI
An application binary interface defining conventions such as calling, data layout, linking, and interaction between compiled components.

Machine-code behavior is defined by the target ISA, but practical execution also depends on the processor implementation, executable format, operating-system ABI, permissions, and runtime environment.