A 4-bit binary number is a base-2 numeric value represented by exactly four digits (bits), capable of expressing 16 distinct states from 0000 to 1111 (decimal 0 to 15). In a physical circuit, upgrading a control scheme from 3 bits to 4 bits doubles your discrete states (from 8 to 16), which directly halves the voltage step size in a resistor-ladder DAC or doubles the addressing capacity of an I/O expander. Understanding this 16-state boundary is critical when you are mapping digital logic pins to analog outputs or configuring hardware addresses on a PCB.

The Complete 16-State Mapping

Before wiring up logic ICs or writing firmware to manipulate a 4-bit nibble, you need the exact mapping in front of you. The table below provides the complete translation for all 16 possible states, including the expected analog output voltages if you were to feed those bits into a standard R-2R resistor ladder DAC referenced to either a 5.0V (classic TTL/Arduino Uno) or 3.3V (ESP32/STM32) logic supply.

Decimal 4-Bit Binary Hexadecimal 5.0V DAC Output (V) 3.3V DAC Output (V)
000000x00.000.00
100010x10.330.22
200100x20.670.44
300110x31.000.66
401000x41.330.88
501010x51.671.10
601100x62.001.32
701110x72.331.54
810000x82.671.76
910010x93.001.98
1010100xA3.332.20
1110110xB3.672.42
1211000xC4.002.64
1311010xD4.332.86
1411100xE4.673.08
1511110xF5.003.30

Note: DAC outputs assume an ideal R-2R network with no load attached. Real-world outputs will droop if the load impedance is not at least 10x higher than the DAC's output impedance.

Worked Example: 4-Bit R-2R DAC Output

Let’s look at how these numbers translate to actual voltages on a workbench. Suppose you are building a simple waveform generator using an Arduino Uno and you decide to build a 4-bit R-2R resistor ladder DAC on a breadboard. You use 10kΩ resistors for the 'R' legs and 20kΩ resistors for the '2R' rungs, connecting the four inputs to digital pins D0 (LSB) through D3 (MSB).

Bench Tip: The step size (resolution) of any DAC is calculated as V_ref / (2^n - 1). For a 4-bit system on a 5.0V reference, your step size is 5.0V / 15 = 0.333V per bit.

If your firmware sets the GPIO pins to the binary value 1010 (Decimal 10, Hex 0xA):

  • D3 (MSB): HIGH (5V) — Contributes 8/15 of the total voltage.
  • D2: LOW (0V) — Contributes 0.
  • D1: HIGH (5V) — Contributes 2/15 of the total voltage.
  • D0 (LSB): LOW (0V) — Contributes 0.

The math: (10 / 15) * 5.0V = 3.33V. If you measure the output node with your multimeter, you should read approximately 3.33V. However, if you used standard 5% tolerance carbon film resistors, your 10kΩ resistors could actually be anywhere from 9.5kΩ to 10.5kΩ. This tolerance stacking means your actual output might read 3.15V or 3.45V. For a 4-bit DAC, 5% resistors are usually acceptable because the 0.33V step size is larger than the tolerance error. But if you ever scale this up to an 8-bit DAC, you must switch to 1% or 0.1% metal film resistors to prevent non-monotonic output steps.

Where You Meet 4-Bit Logic in Practice

You will rarely see a microcontroller process data in 4-bit chunks today—most operate on 8-bit, 16-bit, or 32-bit architectures. However, 4-bit binary numbers (often called a "nibble") are everywhere in hardware interfacing and legacy logic.

1. Port Register Manipulation

When writing bare-metal C for an 8-bit AVR microcontroller (like the ATmega328P), you often need to update only the lower 4 bits of a port register without disturbing the upper 4 bits. You use bitwise masking to isolate the 4-bit binary number:

// Safely write a 4-bit value (e.g., 0x0A) to the lower nibble of PORTD
uint8_t current_port = PORTD;
uint8_t new_nibble = 0x0A; // Binary 1010
PORTD = (current_port & 0xF0) | (new_nibble & 0x0F);

2. Hardware Addressing and DIP Switches

Many industrial I/O modules and standard logic ICs use 4-position DIP switches to set a hardware address or configuration state. A 4-bit DIP switch gives the installer 16 distinct configuration options (0-15), which is usually enough to map out I2C addresses or set baud rate dividers on legacy UART equipment.

3. Hexadecimal Keypads

The standard 4x4 matrix keypad found in alarm systems and access controls outputs 16 distinct characters (0-9 and A-F). Under the hood, the keypad encoder translates these 16 physical buttons into a 4-bit binary code, making it a direct human-to-hardware interface for nibble-sized data entry.

The BCD Trap: Binary vs. Coded Decimal

The most common mistake hobbyists and junior engineers make with 4-bit logic is confusing pure binary with Binary-Coded Decimal (BCD).

In pure 4-bit binary, all 16 states (0000 through 1111) are valid and represent decimal 0 through 15. In BCD, the 4 bits are used strictly to represent single base-10 digits. Therefore, only the states 0000 through 1001 (decimal 0-9) are valid. The states 1010 through 1111 (decimal 10-15) are considered "invalid" or "don't care" states in BCD.

Hardware Trap: If you wire a BCD thumbwheel switch (like the C410 series) into a microcontroller, the switch physically cannot output 1010 through 1111. However, if you use a standard 16-position rotary dip switch and write firmware assuming it's a BCD device, your code will crash or behave unpredictably when the user dials it to positions A-F. Always verify whether your physical input device outputs pure binary or BCD before writing your parsing logic.

This distinction is why chips like the 74HC4511 (a BCD-to-7-segment latch decoder) will actively blank the display if you feed it a binary 1010 (decimal 10)—it recognizes that 10 is not a valid single decimal digit, whereas a pure binary-to-hex decoder would display the letter 'A'.

Frequently Asked Questions

Why is a 4-bit group called a nibble?

The term "nibble" originated in the 1950s and 60s as a playful linguistic derivative of "byte" (originally spelled "bite"). Since a byte is typically 8 bits, a 4-bit grouping is exactly half a byte—hence, a "nibble" (or nybble). It is standard terminology in embedded C programming and assembly language.

Can a 4-bit binary number represent negative values?

Yes, if you use Two's Complement notation. In a signed 4-bit system, the most significant bit (MSB) acts as the sign bit. This shifts your range from 0–15 to -8 through +7. For example, 1000 represents -8, and 1111 represents -1. This is heavily used in digital signal processing (DSP) and small ALUs.

What happens if I connect a 5V 4-bit logic output to a 3.3V microcontroller?

You risk destroying the microcontroller's GPIO pins. A 4-bit logic high from a 5V IC (like a 74HC series chip powered at 5V) will push 5V into a 3.3V-rated pin (like on an ESP32 or Raspberry Pi Pico). You must use a 4-channel logic level shifter (like the Texas Instruments TXS0108E or a simple MOSFET-based bidirectional shifter) to safely step the 4 data lines down to 3.3V.