When configuring GPIO registers, writing I2C addresses, or debugging memory dumps on microcontrollers like the ESP32-WROOM-32 or ATmega2560, you are constantly translating between human-readable hex and machine-level binary. A reliable hexadecimal binary chart eliminates the mental math that leads to off-by-one errors and bricked peripherals.

Below is the complete reference mapping for single nibbles (4-bit) and essential 8-bit bytes, followed by implementation rules for embedded C/C++ and hardware logic design.

The Complete Hexadecimal to Binary Reference Chart

How to read this table: The chart is organized into four primary columns: Hexadecimal, Decimal, 4-Bit Binary (Nibble), and 8-Bit Binary (Padded). Unlike wire ampacity charts, this hexadecimal binary chart does not feature a temperature rating column; however, when deploying these logic values to physical silicon, you must still respect the IC’s operating temperature rating (typically -40°C to 85°C for industrial-grade ESP32 or STM32 chips) to prevent thermal-induced logic state corruption. The standard for base-16 and base-2 notation follows ISO/IEC 80000-13 for information science and technology prefixes, while physical register implementations rely on manufacturer-specific memory maps, such as the Espressif ESP32 Technical Reference Manual.

Hex (Base-16) Decimal (Base-10) 4-Bit Binary (Nibble) 8-Bit Binary (Padded) Common Embedded Use Case
0x0 0 0000 0000 0000 GPIO LOW / Clear Register
0x1 1 0001 0000 0001 Pin 0 HIGH / Bit 0 Set
0x2 2 0010 0000 0010 Pin 1 HIGH / Bit 1 Set
0x3 3 0011 0000 0011 Pins 0-1 HIGH
0x4 4 0100 0000 0100 Pin 2 HIGH / Bit 2 Set
0x5 5 0101 0000 0101 Pins 0, 2 HIGH
0x6 6 0110 0000 0110 Pins 1, 2 HIGH
0x7 7 0111 0000 0111 Pins 0-2 HIGH (Lower Nibble Half)
0x8 8 1000 0000 1000 Pin 3 HIGH / Bit 3 Set
0x9 9 1001 0000 1001 Pins 0, 3 HIGH
0xA 10 1010 0000 1010 Pins 1, 3 HIGH
0xB 11 1011 0000 1011 Pins 0-1, 3 HIGH
0xC 12 1100 0000 1100 Pins 2, 3 HIGH
0xD 13 1101 0000 1101 Pins 0, 2, 3 HIGH
0xE 14 1110 0000 1110 Pins 1-3 HIGH
0xF 15 1111 0000 1111 Lower Nibble Full / 4-Pin Bus HIGH
0x55 85 0101 0101 0101 0101 Alternating Bits (Clock/Test Signal)
0xAA 170 1010 1010 1010 1010 Alternating Bits (Inverted Test)
0x80 128 1000 0000 1000 0000 MSB Set / Signed Integer Negative Flag
0xFF 255 1111 1111 1111 1111 Full Byte HIGH / Pull-up Enable Mask

Bookmark Quick-Jumps: Use the row IDs above to jump directly to the most queried values in embedded debugging: 0x55 (Alternating), 0xAA (Inverted), 0x80 (MSB), and 0xFF (Max Byte).

Applying Hex and Binary in Embedded Implementations

Reading the chart is only the first step. Applying these values correctly in C/C++ firmware or hardware logic requires understanding how your specific architecture handles data width, masking, and memory layout.

Which Column Applies to Your Implementation?

When deciding which column applies to the reader's installation (or in this context, firmware implementation), look at your target register width. If you are manipulating a 4-bit GPIO port group (common on older 8-bit AVR chips like the ATmega328P), use the 4-Bit Binary (Nibble) column to visualize your pin states. If you are writing to a full 8-bit configuration register, an I2C address byte, or an ESP32 32-bit GPIO matrix register, use the 8-Bit Binary (Padded) column. For 32-bit registers, you will stack four 8-bit hex values together (e.g., 0xFFFFFFFF for all 32 pins HIGH).

How Logical Derating (Bit-Masking) Modifies the Base Value

In wire sizing, derating rows modify the base ampacity based on ambient heat. In digital logic, bit-masking and bit-shifting act as logical derating, modifying the base hex value to isolate or move specific bits without altering the rest of the register.

For example, if a register currently holds 0xFF (all pins HIGH) and you need to turn off only Pin 2 (Bit 2), you do not overwrite the whole register. Instead, you apply a logical AND mask using the inverted bit value:

  • Base Value: 0xFF (1111 1111)
  • Mask (NOT 0x04): ~0x04 = 0xFB (1111 1011)
  • Result (0xFF & 0xFB): 0xFB (1111 1011)

This ensures you modify only the target bit while preserving the unmasked state of the hardware.

What the Table Cannot Tell You

A static hexadecimal binary chart cannot tell you the endianness or the signedness of your data. The ESP32 (Xtensa LX6 architecture) is a Little-Endian system. If you write the 16-bit hex value 0x1234 to memory, the chart tells you the binary is 0001 0010 0011 0100. However, the ESP32 will store the least significant byte (0x34) at the lower memory address and the most significant byte (0x12) at the higher address. Furthermore, the chart does not indicate Two's Complement; 0x80 is 128 in unsigned math, but -128 in an 8-bit signed integer.

Frequently Asked Questions (FAQ)

How do I convert a 16-bit hexadecimal binary chart value for ESP32 registers?

Break the 16-bit hex value into two 8-bit nibbles. For example, 0x3F21 splits into 0x3F and 0x21. Look up 0x3F (0011 1111) and 0x21 (0010 0001) on the chart, then concatenate them: 0011 1111 0010 0001. When writing this to a 32-bit ESP32 register via the Espressif API, you will typically cast it as a uint32_t to prevent sign-extension errors.

Why does my hexadecimal binary chart show 0x55 and 0xAA for alternating bits?

0x55 (0101 0101) and 0xAA (1010 1010) are the standard hexadecimal representations for alternating binary states. Hardware engineers use these specific hex values during PCB bring-up and memory testing because they exercise every adjacent trace and capacitor in opposite states, revealing crosstalk, ground bounce, and timing skew that a solid 0xFF or 0x00 would hide.

What is the difference between a hexadecimal binary chart and an ASCII table?

A hexadecimal binary chart maps base-16 numbers directly to base-2 logic states (voltage HIGH/LOW). An ASCII table maps those same hex values to human-readable text characters. For instance, the hex value 0x41 in a binary chart represents the decimal number 65 (0100 0001), but in an ASCII table, 0x41 represents the uppercase letter "A". When debugging UART serial output, ensure your terminal is set to the correct interpretation mode, or your binary sensor data will render as gibberish text.

How do I handle signed integers in a hex to binary conversion?

Standard hex charts assume unsigned integers. If your firmware uses signed 8-bit integers (int8_t), any hex value from 0x80 to 0xFF represents a negative number in Two's Complement format. To find the decimal value of a negative hex number like 0xF4 (1111 0100), invert the bits (0000 1011), add 1 (0000 1100 = 12), and apply the negative sign, resulting in -12. Always verify your variable type in C/C++ before trusting the raw hex output in your serial monitor.