Productivity and Utilities

Cache Address Breakdown Calculator

Enter the cache size, ways, block size and address width to get the tag, index and offset bits.

Your numbers

1 is direct mapped. A power of 2.

A power of 2.

In hexadecimal, such as 0x1A2B3C.

Result

Tag, index, offset

19, 7, 6 bits

128 sets of 4 blocks of 64 bytes in 32,768 bytes.

Offset bits
6
Index bits
7
Tag bits
19
Number of sets
128
Number of blocks
512
Tag storage
9728 bits
How this was calculated
  1. Offset bits = log2(block size) = log2(64) = 6.
  2. Sets = cache size / (ways x block size) = 32768 / (4 x 64) = 128, so index bits = log2(128) = 7.
  3. Tag bits = address bits - index bits - offset bits = 32 - 7 - 6 = 19.
  • This is the usual set-associative layout with a byte-addressed memory. Real caches add valid and dirty bits, and some index with a hash, which this page does not model.

Calculated using SumPanda.com · https://sumpanda.com/cache-address-breakdown-calculator/

Results are estimates for general information. Verify important figures before relying on them.

Next step

How to use the cache address breakdown calculator

  1. Enter the cache size and choose its unit: bytes, KiB or MiB.
  2. Enter the number of ways (1 for direct mapped) and the block size in bytes. Both must be powers of 2.
  3. Enter the address width in bits, such as 32 or 48.
  4. Optionally enter an address in hexadecimal to split it. Read the offset, index and tag bits, the number of sets and blocks and the tag storage.

Formula

Offset bits = log2(block size)

Number of sets = cache size / (ways x block size), and index bits = log2(sets)

Tag bits = address width - index bits - offset bits

Tag storage = number of blocks x tag bits

The offset picks the byte in a block, the index picks the set, and the tag is compared with the tags stored in the set to see whether the block is present. The tag storage excludes valid and dirty bits.

A 32 KiB, 4-way cache with 64 byte blocks and 32 bit addresses

The cache holds 32768 / 64 = 512 blocks and has 512 / 4 = 128 sets. The offset takes 6 bits and the index takes 7 bits, which leaves 32 - 7 - 6 = 19 bits for the tag. The tag storage is 512 x 19 = 9728 bits.

For a 1 MiB, 16-way cache with the same block size there are 1024 sets, so the index takes 10 bits and the tag 16 bits. The address 0x1A2B3C then splits into tag 0x1a, set 172 and offset 60. A direct mapped cache has one block per set, so it has more sets and a longer index.

What the fields do

When the processor reads an address, the hardware uses the index bits to find a set and compares the tag with the tag of each block in that set, in parallel. A match is a hit and the offset picks the byte or word. A miss brings in the whole block, and if the set is full a block is chosen for replacement.

To see how the block is chosen, use the cache replacement policy simulator. To convert an address between bases, see the binary calculator.

Trade-offs

More ways reduce conflict misses but cost more comparators and a slower lookup. Larger blocks use spatial locality but waste capacity and time when only a small part is needed. A fully associative cache has one set, no index and the longest tag. A direct mapped cache has the shortest tag and the most conflicts.

Faster memory helps only the part of the run time spent waiting for it, which is why the Amdahl's law calculator is a good companion for estimating the overall gain.

Assumptions and limits

  • The cache is physically indexed and tagged, and all addresses are byte addresses.
  • Cache size, ways and block size are powers of 2, with at least one set.
  • Tag storage counts only the tag bits, not valid, dirty or replacement bits.
  • The optional address is hexadecimal and must fit in the address width.

Formulas reviewed October 10, 2026. See the calculation methodology for how SumPanda rounds, tests and sources its formulas.

Frequently asked questions

How do I find the number of index bits?

Divide the cache size by the ways times the block size to get the sets, then take log base 2 of the number of sets.

What is the tag for?

Many addresses map to the same set. The tag identifies which block is stored, so the hardware can tell a hit from a miss.

What is a direct mapped cache?

It is a cache with one way, so each address maps to exactly one block. It has the most sets, the fewest comparators and the most conflict misses.

Can I split an address?

Yes. Enter it in hexadecimal and the page shows the tag in hexadecimal, the set number and the byte offset.