Cache line offset bits calculator
Calculate how many low address bits select a byte within a cache line. Enter your values below to see the result and method.
inputs.
Related calculators
How to use this calculator
Free Cache line offset bits calculator. Calculate how many low address bits select a byte within a cache line. Formula, example, and assumptions explained.
- Enter Cache line size (bytes). Match the units shown beside each field and review the result together with the assumptions below.
- Read the worked example below to check the expected input format and result.
- Compare another scenario by changing one input at a time. Use Reset to return to the starting values.
Define the system or input
Calculate how many low address bits select a byte within a cache line.
Inputs and units
Use the units printed beside each field. This value is Cache line size (bytes).
- Cache line size (bytes):Number of byte-addressable positions in one line; a power-of-two size gives log₂(line size) offset bits.
Calculation method and example
Offset bits = log₂(line size).
A 64-byte cache line uses 6 byte-offset bits.
For a supported power-of-two line size, log₂(size) gives an exact whole-number byte-offset width.
Interpreting the output
The result is the integer width of the low-order address field that selects a byte within the specified power-of-two cache line; it excludes index and tag bits.
Assumptions and limitations
Line size must be a power of two and assumes byte-addressable memory.
Source and method
The lecture illustrates low-order byte-offset bits and the address fields used by a cache. MIT OpenCourseWare — Computation Structures, cache addresses.
Frequently asked questions
What do cache line offset bits identify?
They are the low-order address bits that choose a byte within one cache line. A 64-byte line needs log₂(64)=6 offset bits.
Why must the line size be a power of two?
A binary address uses a whole-number offset width only when the byte count per line is a power of two; non-power-of-two sizes do not map to one integer bit count.
How do offset bits differ from cache index bits?
Offset bits select a byte within a line. Index bits select a cache set or line; tag bits distinguish addresses that map to the same set.
How do I use the Cache line offset bits calculator?
Enter Cache line size (bytes). Match the units shown beside each field and review the result together with the assumptions below.
What is a worked example of Cache line offset bits?
Offset bits = log₂(line size). A 64-byte cache line uses 6 byte-offset bits. For a supported power-of-two line size, log₂(size) gives an exact whole-number byte-offset width.
Read the calculation methodology and privacy policy.