The binary and hexadecimal chart is the foundational lookup tool for embedded systems, mapping 8-bit bytes across Base-2 (binary), Base-10 (decimal), and Base-16 (hex). For microcontroller development, the direct rule is simple: use Hexadecimal for memory addresses and I2C/SPI protocols, use Binary for GPIO pin masks and bitwise logic, and use Decimal only for human-readable math like PWM duty cycles or analog sensor scaling.

The Complete Binary and Hexadecimal Chart (Nibble & Bitmask)

Rather than scrolling through 256 rows of redundant data, professional embedded engineers use the standard IEEE 8-bit byte composition model. The chart below provides the complete 4-bit nibble mapping and the complete 8-bit power-of-two bitmask table. Any 8-bit byte (0x00 to 0xFF) is constructed by combining two nibbles (e.g., 0x5A is the 0x50 row plus the 0x0A row). This structure conforms to standard Base-16/Base-2 mathematical mapping conventions outlined in digital logic standards like All About Circuits Digital Logic and Espressif ESP-IDF documentation.

How to read this table: The 'Hex' column is your protocol address format (prefix with 0x). The 'Binary' column is your bitwise operation format (prefix with 0b). The 'Bitmask' section shows the exact binary state when shifting a single bit across an 8-bit register, which is how you isolate or trigger specific hardware pins.
Table 1: 4-Bit Nibble Composition & 8-Bit Bitmask Reference
Hex (0x)DecimalBinary (0b)Bitmask Shift (1 << n)Hex Mask
0x000000n=0 (Bit 0)0x01
0x110001n=1 (Bit 1)0x02
0x220010n=2 (Bit 2)0x04
0x330011n=3 (Bit 3)0x08
0x440100n=4 (Bit 4)0x10
0x550101n=5 (Bit 5)0x20
0x660110n=6 (Bit 6)0x40
0x770111n=7 (Bit 7)0x80
0x881000(Upper nibble starts)
0x991001Shift left by 4 bits
0xA101010e.g., 0xA << 4 = 0xA0
0xB111011
0xC121100
0xD131101
0xE141110
0xF151111

Decision Path: Which Base Applies to Your Protocol?

Choosing the wrong base leads to unreadable code and compilation errors. Use this decision tree to lock in the correct format for your specific hardware interface. This path terminates in a concrete syntax pick for your IDE.

Hardware TaskCondition / ProtocolConcrete Pick (Syntax)Example (ESP32/Arduino)
Sensor Addressing I2C Bus (e.g., BME280, MPU6050) Hexadecimal Wire.beginTransmission(0x76);
Pin Manipulation Direct GPIO Register Masking Binary GPIO.out_w1ts = 0b00000100;
Memory / Flash SPI NOR Flash Commands Hexadecimal SPI.transfer(0x9E); // Read JEDEC ID
Analog / PWM Duty Cycle or ADC Scaling Decimal ledcWrite(0, 2048); // 50% of 4096
Character Data UART / Serial Text Strings ASCII / Hex Serial.write(0x0A); // Line feed
Default Recommendation: If you are writing a custom driver for an IC and reading its datasheet, always default to Hexadecimal for register addresses and command bytes. Datasheets universally index registers in Hex. Only drop to Binary when you need to visually verify individual bit states within that register.

Modifying Base Values: Bit-Shifting and Masking

In electrical wiring, derating factors modify the base ampacity of a conductor based on temperature and bundling. In digital logic, bit-shifting and masking operations modify the base binary/hex value to target specific hardware registers without altering surrounding data.

When you look up a value in the binary and hexadecimal chart, you rarely use it raw. You modify it using C/C++ bitwise operators to fit the microcontroller's 32-bit or 8-bit register boundaries.

  • Left Shift (<<): Multiplies the base value by powers of 2. If your chart shows the bitmask for Bit 2 is 0x04 (0b00000100), shifting it left by 4 positions (0x04 << 4) yields 0x40 (0b01000000). This is how you move a configuration bit from a low-byte register to a high-byte register.
  • Right Shift (>>): Divides the base value. Used to extract high-nibble data. If an I2C sensor returns 0xA5 and you only need the top 4 bits, shifting right (0xA5 >> 4) yields 0x0A.
  • Bitwise AND (&): Acts as a filter mask. To check if Bit 3 is set in a status register reading 0x3C, you AND it with the chart's Bit 3 mask: 0x3C & 0x08. If the result is non-zero, the bit is high.
  • Bitwise OR (|): Forces bits high without clearing others. To set Bit 1 and Bit 2 high simultaneously, OR their chart masks: 0x02 | 0x04 = 0x06 (0b00000110).

What This Chart Cannot Tell You (Edge Cases & Pitfalls)

The binary and hexadecimal chart is a pure mathematical mapping. It is blind to physical hardware realities and compiler interpretations. Before flashing your firmware, account for these three limitations:

  1. Endianness (Byte Order): The chart maps single bytes. It cannot tell you how a 16-bit or 32-bit integer is stored in memory. An ESP32 (Xtensa/RISC-V architecture) is typically Little-Endian. If you write the 16-bit hex value 0x1234 to memory, it is physically stored as 0x34 followed by 0x12. Always verify your target IC's endianness when sending multi-byte SPI/I2C payloads.
  2. Signed vs. Unsigned (Two's Complement): The chart shows 0xFF as decimal 255. However, if your C++ variable is declared as an int8_t (signed 8-bit integer), the compiler interprets 0xFF as -1. The binary pattern is identical (11111111), but the mathematical behavior in your code will cause catastrophic errors if you use it for threshold comparisons.
  3. Physical Voltage Mapping: A logic '1' (binary 1) in the chart does not specify voltage. On an Arduino Uno, a '1' maps to 5V. On an ESP32-WROOM-32, a '1' maps to 3.3V. Feeding a 5V '1' into an ESP32 GPIO pin will destroy the silicon. The chart defines logic states, not electrical characteristics.

Quick-Jump Reference: Most Queried Hex and Binary Values

Bookmark this section. These specific byte values appear constantly in embedded debugging, protocol initialization, and memory wiping. Knowing them by heart saves time when reading logic analyzer traces.

HexBinaryCommon Embedded Use Case
0x00 00000000 Ground / Clear: Used to reset registers, clear interrupt flags, or initialize memory buffers to a known zero state.
0x55 01010101 UART Auto-Baud: The alternating bit pattern is universally used by bootloaders to detect serial baud rates via the first falling edge timing.
0xAA 10101010 SPI Flash Dummy: Standard dummy byte sent during SPI read operations to clock out data, and used in specific NOR flash erase commands.
0x7F 01111111 Max Positive Signed: The maximum positive value for an 8-bit signed integer (+127). Often used as a max-limit cap in motor control PWM.
0x80 10000000 Sign Bit / MSB: Sets the Most Significant Bit. In I2C, setting this bit often triggers a 'Read' operation or a register auto-increment flag.
0xFF 11111111 Pull-Up / Erased Flash: The default state of an unprogrammed EEPROM/Flash byte. Also used as the I2C General Call address and SPI bus idle state.

By mastering the composition of nibbles and the specific behavioral quirks of bitwise modification, you eliminate the guesswork from register-level programming. Keep your hex prefixes explicit, respect your compiler's signed/unsigned boundaries, and let the decision tree dictate your syntax.