The binary table for numbers is the definitive lookup for translating base-2 logic states (HIGH/LOW, 1/0) into human-readable decimal and hexadecimal values. If you are configuring an ESP32 GPIO register, setting an I2C address, or debugging a bitwise operation, the direct answer is that an 8-bit binary sequence like 10100101 equals 165 in decimal and 0xA5 in hex. Mastering this table eliminates the guesswork when writing firmware for microcontrollers or tracing digital logic on an oscilloscope.

The Master Binary Table for Numbers (Base Nibble & Byte Boundaries)

Before reading the table, understand its structure. The foundation of all binary math relies on the 4-bit "nibble" (0-15). Any 8-bit, 16-bit, or 32-bit number is simply a concatenation of these base patterns. The values below conform to the positional notation defined in ISO/IEC 80000-13 (Information science and technology) and the C99 stdint.h standard used by Arduino and ESP-IDF compilers.

How to read this table: The Binary column shows the raw base-2 states (read right-to-left as 2^0, 2^1, 2^2, 2^3). The Hex column is your primary tool for memory addresses and I2C/SPI configurations. The 8-Bit Padded column shows how the microcontroller actually stores the value in an 8-bit register, padding leading zeros to prevent bitwise shift errors.
Table 1: Complete 4-Bit Base Nibble Reference (ISO/IEC 80000-13)
Decimal Hexadecimal Binary (Raw) 8-Bit Padded (uint8_t) Common Electronics Use Case
00x0000000000000Logic LOW / GND reference
10x1000100000001Bit 0 mask (Pin 0)
20x2001000000010Bit 1 mask (Pin 1)
30x3001100000011I2C address suffix / 2-pin combo
40x4010000000100Bit 2 mask (Pin 2)
50x5010100000101Alternating bit pattern test
60x6011000000110RS-232 / UART framing bits
70x70111000001113-bit DAC max value
80x8100000001000Bit 3 mask (Pin 3 / MSB of nibble)
90x9100100001001BCD (Binary Coded Decimal) 9
100xA101000001010SPI clock polarity/phase (CPOL/CPHA)
110xB101100001011Hex B (often used in MAC addresses)
120xC110000001100I2C start/stop condition masks
130xD110100001101UART baud rate divisor fragments
140xE111000001110Hex E (EEPROM page boundaries)
150xF111100001111Lower nibble mask (0x0F)

Bookmark-Friendly Quick-Jump: Byte & Register Boundaries

When working beyond 4 bits, you rarely need the full 0-255 sequence. You need the boundary values that dictate when a variable overflows or when a specific hardware register maxes out. Reference these rows directly when sizing variables in C/C++.

Table 2: Microcontroller Register Boundaries (C99 stdint.h)
Data Type Bits Max Unsigned (Decimal) Max Unsigned (Hex) Binary Representation
uint8_t / byte82550xFF11111111
uint16_t / unsigned int1665,5350xFFFF11111111 11111111
uint32_t324,294,967,2950xFFFFFFFF11111111... (32 ones)
int8_t (Signed)81270x7F01111111

Which Column Applies to Your Installation?

Choosing the right column depends entirely on the hardware layer you are interacting with. Using decimal for hardware registers leads to unreadable code and bitwise errors.

  • Use the Binary Column (Padded) when: You are manipulating individual GPIO pins on a port register. For example, setting pins 2 and 3 HIGH on an AVR ATmega328P requires writing 0b00001100 to the PORTD register. Binary makes the physical pin mapping visually explicit.
  • Use the Hexadecimal Column when: You are configuring I2C addresses, SPI control registers, or memory pointers. An SSD1306 OLED display initializes at 0x3C. Reading 0x3C instantly tells an engineer that the lower nibble is 1100 and the upper is 0011. Decimal 60 hides this hardware reality.
  • Use the Decimal Column when: You are performing human-scale math, such as calculating PWM duty cycles (e.g., analogWrite(pin, 128) for 50% duty cycle on an 8-bit timer) or converting ADC sensor readings to real-world voltage.

How Signed Formats and Bit-Shifting Modify Base Values

In wire sizing, temperature derating modifies the base ampacity. In binary logic, Two's Complement and Bit-Shifting modify the base decimal value. If you assume a binary table is strictly positive, your microcontroller will silently invert your logic when handling negative sensor data or reverse motor directions.

The Two's Complement Modification: To represent a negative number in an 8-bit signed integer (int8_t), the microcontroller flips all bits of the positive binary value and adds 1. Therefore, decimal -1 is not 10000001 (which is -127 in signed magnitude); it is 11111111 (0xFF). If you pass 0xFF to an unsigned variable, it reads as 255. This mismatch is the #1 cause of "ghost" bugs in embedded C.

Bit-Shifting Modifiers: Shifting a binary number left by one position (<< 1) multiplies the base value by 2. Shifting right (>> 1) divides by 2. This is how hardware registers scale values without using CPU-heavy multiplication instructions.

  • Base Value: 00000011 (Decimal 3)
  • Shift Left 2 (<< 2): 00001100 (Decimal 12)
  • Shift Right 1 (>> 1): 00000001 (Decimal 1, note the lost fractional bit)

Decision Path: Selecting Your Data Type and Bitmask

Use this decision tree to terminate your debugging process and select the exact C/C++ data type and bitmask required for your firmware. Default to unsigned integers unless your sensor explicitly outputs negative values.

Table 3: Firmware Bitwise Decision Matrix
Condition / Task Required Action Concrete Pick (Code / Value)
Reading a single GPIO pin state from a 32-bit register (ESP32) Isolate the target bit using bitwise AND and a shifted mask if (REG_READ(GPIO_IN_REG) & (1 << PIN_NUM))
Configuring an I2C peripheral address Use 7-bit Hexadecimal (ignore the R/W LSB for standard Arduino Wire library) 0x3C (OLED) or 0x68 (MPU6050)
Storing an ADC reading (0-4095 on ESP32 12-bit ADC) Use a 16-bit unsigned integer to prevent 8-bit overflow uint16_t adc_val = analogRead(34);
Clearing a specific bit in a control register without affecting others Use bitwise AND with the inverted mask (NOT operator) REG &= ~(1 << BIT_POS);
Handling temperature data that drops below 0°C Use a signed 16-bit integer to preserve the Two's Complement sign bit int16_t temp_raw = read_sensor();

What the Binary Table Cannot Tell You (Hardware Limits)

While the binary table for numbers provides the mathematical truth, it lacks the physical context of your specific silicon. Keep these three hardware limitations in mind when translating table values to physical wiring:

  1. Endianness (Byte Order): The table assumes you are reading a single byte. When you move to 16-bit or 32-bit numbers, the ESP32 (Xtensa architecture) and Arduino Uno (AVR) are Little-Endian. This means the least significant byte is stored at the lowest memory address. If you read a 16-bit hex value 0x1234 directly from memory byte-by-byte, you will read 0x34 first, then 0x12. Network protocols (like MQTT or TCP/IP) require Big-Endian, forcing you to use byte-swap functions before transmission.
  2. I2C 7-Bit vs. 8-Bit Addressing: The standard I2C specification uses a 7-bit address, but the physical bus transmits 8 bits (the 8th bit is the Read/Write flag). If a datasheet lists an I2C address as 0xD0, it is likely showing the 8-bit shifted value. You must shift it right by one (0xD0 >> 1) to get the 0x68 value required by the Arduino Wire.h library.
  3. Logic Level Voltages: A binary 1 does not universally mean 5 Volts. On an Arduino Uno (ATmega328P), a 1 is 5V. On an ESP32-WROOM-32, a 1 is 3.3V. Feeding a 5V binary HIGH into a 3.3V ESP32 GPIO pin without a logic level converter or voltage divider will destroy the silicon, regardless of what the binary table says.

For authoritative details on microcontroller data types, refer to the Arduino Language Reference for byte/uint8_t. For deeper hardware register manipulation on 32-bit systems, consult the Espressif ESP32 GPIO API Reference. Standardized binary prefix definitions (like Kibi vs. Kilo) are maintained by NIST Binary Prefixes guidelines.