Virtual Memory Utility

Page Offset Calculator

Enter a memory address and page size to find the exact page offset, page number, page base address, page end address, and number of offset bits.

Page offset Page number Page boundaries
Calculate Page Number & Offset
Page size must be a positive power of two, such as 4096, 8192, 16384, or 65536 bytes.
Page Offset 0x345 837 bytes inside the page
Page Number 0x12 Page index 18 in decimal
Page Base 0x12000
Page End 0x12FFF
Offset Bits 12 bits
Bytes to Page End 3259 bytes
Calculation
0x12345 = page 0x12 × 4096 + offset 0x345
Memory Paging

What Is a Page Offset?

A page offset identifies the exact byte position of an address within its memory page. When an address space is divided into fixed-size pages, each address can be separated into a page number and an offset inside that page.

For a page size of 4096 bytes, every page contains byte offsets from 0 through 4095. An address located at the beginning of a page has offset zero, while the final byte in the page has offset 4095.

Page offset pageOffset = address mod pageSize
Core Calculation

How to Calculate Page Number and Page Offset

The page number is obtained using integer division, while the page offset is the remainder after dividing the address by the page size.

1
Choose the memory address Enter the virtual or physical address you want to divide into page and offset components.
2
Enter the page size Use the page size in bytes. Common examples include 4096 bytes for 4 KiB and 8192 bytes for 8 KiB.
3
Calculate the page number Integer division of the address by page size gives the zero-based page number.
4
Find the remainder The remainder is the byte offset of the address from the beginning of its page.
Page number pageNumber = floor(address / pageSize)
Worked Example

Page Offset of Address 0x12345 with a 4 KiB Page

A 4 KiB page contains 4096 bytes, which is 0x1000 in hexadecimal.

0x12345 with 4096-byte pages
Address = 0x12345 Page size = 4096 bytes = 0x1000 Page number: 0x12345 / 0x1000 = 0x12 = 18 decimal Page offset: 0x12345 mod 0x1000 = 0x345 = 837 decimal Therefore: Page number = 18 Page offset = 837 bytes
Page Boundaries

Find the Page Base and Page End Address

Once the page number is known, the beginning of that page is found by multiplying the page number by the page size.

Page base address pageBase = pageNumber × pageSize

The inclusive final byte address of the page is the base plus the page size minus one.

Page end address pageEnd = pageBase + pageSize – 1
Boundaries containing address 0x12345
Page number = 0x12 Page size = 0x1000 Page base: 0x12 × 0x1000 = 0x12000 Page end: 0x12000 + 0x1000 – 1 = 0x12FFF Address 0x12345 is therefore inside: 0x12000 – 0x12FFF
Offset Bits

How Many Bits Are Used for the Page Offset?

When the page size is a power of two, the number of low-order address bits used for the page offset is the base-2 logarithm of the page size.

Offset bit count offsetBits = log₂(pageSize)

A 4096-byte page is 2¹² bytes, so the lowest 12 address bits represent the page offset. An 8192-byte page is 2¹³, so it uses 13 offset bits.

Page Size Bytes Hex Size Offset Bits Maximum Offset
1 KiB 1,024 0x400 10 0x3FF
4 KiB 4,096 0x1000 12 0xFFF
8 KiB 8,192 0x2000 13 0x1FFF
16 KiB 16,384 0x4000 14 0x3FFF
64 KiB 65,536 0x10000 16 0xFFFF
Bitwise Method

Calculate a Page Offset with a Bit Mask

For a power-of-two page size, the page offset can also be obtained using a mask equal to pageSize - 1. The low-order bits selected by this mask are exactly the offset bits.

Power-of-two page offset pageOffset = address & (pageSize – 1)
4 KiB page mask
Page size = 4096 = 0x1000 Offset mask: 0x1000 – 1 = 0xFFF Address: 0x12345 Offset: 0x12345 & 0xFFF = 0x345
Page Number

Page Number vs Page Offset

The page number identifies which page contains an address. The page offset identifies the byte position within that page. Together they describe the original address relative to the selected page size.

Reconstruct the address address = pageNumber × pageSize + pageOffset

For address 0x12345 using 4 KiB pages, page 0x12 contributes 0x12000, while the offset contributes 0x345. Adding them reconstructs 0x12345.

Alignment

What Happens When an Address Is Page Aligned?

An address is page aligned when it is an exact multiple of the page size. A page-aligned address always has a page offset of zero.

Page-aligned example
Address = 0x10000 Page size = 0x1000 0x10000 mod 0x1000 = 0 Page offset = 0 Page base = 0x10000 The address is exactly at the beginning of its page.
Remaining Bytes

Bytes Remaining in the Current Page

The calculator also reports how many bytes occur after the selected address before reaching the inclusive end of the current page.

Bytes after address remaining = pageSize – pageOffset – 1

If the offset is zero in a 4096-byte page, there are 4095 byte positions after the current address. If the address is already the final byte of the page, the result is zero.

Examples

Page Number and Offset Examples

Address Page Size Page Number Offset Page Base
0x12345 4096 0x12 0x345 0x12000
0x1ABC 4096 0x1 0xABC 0x1000
0x10000 4096 0x10 0x0 0x10000
0xFFFF 4096 0xF 0xFFF 0xF000
0x12345 8192 0x9 0x345 0x12000
Virtual Memory

Page Offsets in Virtual Memory

Operating systems commonly divide virtual address spaces into pages. A virtual address can conceptually be separated into a virtual page number and an offset within that page.

During address translation, page-table structures are used to determine the corresponding physical frame. The offset identifies the location inside the page and normally remains the same when the virtual page is mapped to a physical frame of the same page size.

This calculator performs numerical page decomposition only. It does not inspect page tables, translate virtual addresses to physical addresses, or determine whether an address is mapped.
4 KiB Pages

Why 4 KiB Pages Have a 12-Bit Offset

A 4 KiB page contains 4096 bytes. Because 4096 equals 2¹², twelve binary bits are required to select one of the 4096 byte positions inside the page.

Therefore, with 4 KiB pages, the lowest 12 bits of an address are the page offset. All higher-order bits form the page-number portion of the numerical address decomposition.

4 KiB page decomposition
Page size = 4096 = 2^12 Offset bits = 12 Offset range: 0x000 through 0xFFF Address 0x12345: Page portion = 0x12 Offset = 0x345
Larger Pages

How Page Size Changes the Offset

Increasing page size increases the number of bits assigned to the page offset. As a result, the same address may have a different page number and offset when interpreted using another page size.

For example, 4 KiB pages use 12 offset bits, while 8 KiB pages use 13. A 64 KiB page uses 16 offset bits.

This is why the page size must always be known before interpreting an address as a page number plus offset.

Applications

Where Page Offset Calculations Are Useful

Operating Systems

Study page boundaries and decompose virtual or physical addresses.

Memory Management

Determine the location of an address relative to its current page.

Systems Programming

Work with page-aligned buffers, mappings, allocators, and low-level memory.

Debugging

Identify page boundaries around addresses shown by debuggers or memory tools.

Computer Architecture

Practice page-number and offset calculations used in virtual-memory concepts.

Memory-Mapped Files

Reason about positions and alignment relative to page-sized mapping units.

Exact Arithmetic

Large Address Support with BigInt

Memory addresses are integer values, so page calculations should not lose precision. Ordinary floating-point numbers cannot represent every sufficiently large integer exactly.

The calculator uses JavaScript BigInt for the address, page size, page number, page base, page end, and page offset. This keeps all arithmetic exact.

The page-size validation is also performed using integer bit operations, ensuring that the supplied size is an exact power of two.

Common Mistakes

Common Page Offset Calculation Mistakes

Using the address divided by page size as the offset

Integer division gives the page number. The remainder gives the page offset.

Using the wrong page size

Page decomposition depends directly on page size. The same address can belong to a different numbered page when another size is selected.

Confusing page offset with memory offset

A general memory offset is the difference between two arbitrary addresses. A page offset specifically measures an address from the beginning of its containing page.

Forgetting that page offset starts at zero

The first byte of every page has offset 0. The final offset is page size minus one.

Assuming every page size is valid for bit masking

The simple address & (pageSize - 1) technique requires a power-of-two page size. This calculator therefore validates that condition.

FAQ

Page Offset Calculator FAQs

Calculate the remainder when the memory address is divided by the page size: page offset = address mod page size.
Use integer division: page number = floor(address / page size).
The page offset is 0x345, equal to 837 decimal bytes. The page number is 0x12, or 18 decimal.
A 4 KiB page contains 4096 or 2^12 bytes, so it requires 12 page-offset bits.
The maximum offset is 4095 decimal, which is 0xFFF hexadecimal.
Multiply the page number by the page size. For a power-of-two size, clearing the offset bits produces the same page base.
It means the address is exactly at the beginning of a page and is aligned to the selected page size.
Yes. Enter the size in decimal bytes, such as 8192 for 8 KiB or 65536 for 64 KiB.
This tool models power-of-two memory pages so the offset corresponds to a fixed number of low-order address bits and can be extracted using a bit mask.
No. The page number identifies the page, while the page offset identifies the byte position inside that page.
No. The calculator decomposes an integer address using a chosen page size. It does not read page tables or perform actual virtual-to-physical translation.
Yes. It uses JavaScript BigInt so large integer addresses can be processed without ordinary floating-point precision loss.
Scroll to Top