First time learning assembly, is this saying a word size is 8-bytes?
Categories:
Understanding Word Size in x86-64 Assembly: 8-byte Confusion Explained

Demystify the concept of 'word size' in x86-64 assembly, clarifying common misconceptions about 8-byte definitions and their implications for registers and memory operations.
When first diving into assembly language, especially x86-64, terms like 'word' can be confusing due to their historical evolution and differing interpretations. A common point of confusion arises when encountering documentation or discussions that seem to imply a 'word' is 8 bytes, while other contexts define it differently. This article aims to clarify what 'word size' means in the context of x86-64 architecture and how it relates to register sizes and memory addressing.
The Evolving Definition of 'Word'
Historically, a 'word' was often defined as the natural unit of data that a CPU processes, typically corresponding to the size of its general-purpose registers. In the early days of computing, this was often 16 bits (2 bytes). With the advent of 32-bit processors (like the Intel 80386), a 'double word' (DWORD) became 32 bits (4 bytes), and a 'quad word' (QWORD) became 64 bits (8 bytes). However, in the x86-64 architecture, the primary general-purpose registers are 64 bits wide. This leads to the natural inclination to consider 64 bits (8 bytes) as the 'word size' for this architecture, even though the traditional definitions persist for backward compatibility and specific instruction sets.
flowchart TD A[Early CPUs (e.g., 8086)] --> B{Word = 16-bit (2 bytes)} B --> C[32-bit CPUs (e.g., 80386)] C --> D{Word = 16-bit (2 bytes)} C --> E{Double Word (DWORD) = 32-bit (4 bytes)} E --> F[64-bit CPUs (x86-64)] F --> G{Word = 16-bit (2 bytes) (Legacy)} F --> H{Double Word (DWORD) = 32-bit (4 bytes) (Legacy)} F --> I{Quad Word (QWORD) = 64-bit (8 bytes)} I --> J["Common 'Natural' Word Size in x86-64 = 64-bit (8 bytes)"]
Evolution of 'Word' Definition Across x86 Architectures
x86-64 Register Sizes and Terminology
In x86-64 assembly, the general-purpose registers (like RAX, RBX, RCX, RDX, RSI, RDI, RBP, RSP, R8-R15) are 64 bits wide. When you see instructions operating on these full registers, they are indeed manipulating 8-byte (64-bit) values. However, the architecture also provides ways to access smaller portions of these registers, using the older terminology:
- Byte (B): 8 bits
- Word (W): 16 bits (2 bytes)
- Double Word (D): 32 bits (4 bytes)
- Quad Word (Q): 64 bits (8 bytes)
So, while the natural or preferred data size for many operations in x86-64 is 64 bits (a quad word), the term 'word' by itself still refers to 16 bits. This distinction is crucial when interpreting instruction suffixes or memory operand sizes.
; Example of different data sizes in x86-64 assembly
section .data
my_byte db 0xAA ; Define a byte (8 bits)
my_word dw 0xBBCC ; Define a word (16 bits)
my_dword dd 0xDDEEFF00 ; Define a double word (32 bits)
my_qword dq 0x1122334455667788 ; Define a quad word (64 bits)
section .text
global _start
_start:
; Move a byte into AL (lower 8 bits of RAX)
mov al, [my_byte]
; Move a word into AX (lower 16 bits of RAX)
mov ax, [my_word]
; Move a double word into EAX (lower 32 bits of RAX)
mov eax, [my_dword]
; Move a quad word into RAX (full 64 bits)
mov rax, [my_qword]
; Exit program (syscall for Linux)
mov rax, 60 ; syscall number for exit
mov rdi, 0 ; exit code 0
syscall
Demonstration of different data size directives and register access in NASM x86-64
MOV B
for byte, MOV W
for word, MOV D
for double word, MOV Q
for quad word, though often implied by register size) and the register names (e.g., AL
, AX
, EAX
, RAX
) to understand the exact data size being operated on.Why the Confusion? Context is Key
The confusion often stems from the fact that while the architecture's native processing unit for general-purpose operations is 64-bit, the historical terminology for data sizes (byte, word, dword, qword) remains. When someone says 'word size' in a general x86-64 context, they might implicitly be referring to the 64-bit register size, which is technically a 'quad word'. However, if they are referring to a specific instruction or memory operand size using the WORD
directive, they mean 16 bits.
It's best to be explicit: refer to 8-bit, 16-bit, 32-bit, or 64-bit values, or use the specific terms 'byte', 'word', 'double word', and 'quad word' to avoid ambiguity. In the context of the native register width of x86-64, the 'word size' is effectively 64 bits, but the term 'word' still means 16 bits.

RAX Register Breakdown: Illustrating 64-bit, 32-bit, 16-bit, and 8-bit access.