I2C Address Converter
Convert between a 7-bit I2C slave address and the 8-bit address byte transmitted on the bus. Calculate read and write address bytes and view hexadecimal, decimal and binary forms.
8-bit read byte = (7-bit address << 1) + 1
What Is an I2C Address?
I2C uses addresses so a controller can select a particular peripheral on the shared serial bus. The most common form uses a 7-bit device address.
During transfer, those seven address bits are placed into bits 7 through 1 of an eight-bit address byte. Bit 0 is then used as the Read/Write control bit.
7-Bit vs 8-Bit I2C Address
A common source of confusion is that some datasheets describe the device using its 7-bit address, while others list separate 8-bit read and write address bytes.
Write byte: 78
Read byte: 79
All three values refer to the same 7-bit-addressed device.
Convert 7-Bit I2C Address to Write Address
To produce the write address byte, shift the seven-bit address left by one position. The new bit 0 is then zero.
0x3C << 1
= 0x78
Write byte: 0x78
Convert 7-Bit I2C Address to Read Address
The read address uses the same shifted address but sets the least-significant R/W bit to 1.
Shifted: 0x78
Set R/W bit: 0x79
Read byte: 0x79
I2C Read/Write Bit
The least-significant bit of the transmitted address byte indicates the transfer direction.
| R/W Bit | Meaning |
|---|---|
| 0 | Write operation |
| 1 | Read operation |
I2C Binary Address Example
The 7-bit address 0x3C is:
After shifting left:
Read: 01111001
The upper seven transmitted bits are identical. Only the final R/W bit changes.
Convert an 8-Bit I2C Address Byte Back to 7 Bits
When an 8-bit address byte is known, its original seven-bit slave address can be recovered by removing the least-significant R/W bit.
Binary: 01111001
R/W: 1 = Read
7-bit address: 0111100
= 0x3C
Why I2C Address Confusion Happens
A peripheral may be described as having address 0x3C in one document, while another table shows 0x78 for writing and 0x79 for reading.
These are not necessarily three different addresses. The first is the seven-bit device address, while the latter two include the direction bit.
This converter makes the relationship explicit so binary and embedded-system developers can compare documentation correctly.
7-Bit I2C Address Range
A seven-bit binary field can mathematically contain values from 0 through 127.
Hex: 00 through 7F
However, not every value in that mathematical range should be assigned to an ordinary peripheral because I2C reserves certain address patterns for special purposes.
I2C Address vs Device Register Address
The I2C slave address identifies the peripheral on the bus. A register address identifies a location inside that peripheral.
| Address | Purpose |
|---|---|
| I2C Device Address | Selects the peripheral on the bus |
| Internal Register Address | Selects a register inside the peripheral |
This calculator converts the I2C device-address field only.
I2C Address Converter Example
Suppose a sensor datasheet states:
The write address byte is:
The read address byte is:
So:
Write: D0
Read: D1
Important I2C Address Notes
The 7-bit address occupies bits 7 through 1 of the transmitted address byte.
Bit 0 is the Read/Write bit.
R/W = 0 indicates write.
R/W = 1 indicates read.
The mathematical 7-bit range is 0x00 through 0x7F, but some address patterns are reserved by the I2C specification.
The tool does not implement 10-bit I2C addressing.
The device address should not be confused with internal sensor, EEPROM or peripheral register addresses.
Always verify whether a datasheet lists a 7-bit slave address or an already-shifted 8-bit address byte.