Skip to content
Hex Calculator

Hex to 7-Segment Display Converter

Convert hex digits into their 7-segment display encoding — the standard segment byte for each digit 0-F, common-cathode, active-high.

7-segment byte(s)
0x7F
Swapnil Sanghvi

Built by

Swapnil Sanghvi

Full-Stack Web Developer & WordPress Developer

Swapnil Sanghvi is a full-stack web and WordPress developer, UI designer, and full-time freelancer who builds and maintains Hex Calculator.

Hex to 7-Segment Display Converter tool preview card from Hex Calculator
Share preview: this is the card that appears when you share the Hex to 7-Segment Display Converter page on social media.

Further reading: hex — Stack Overflow

How 7-Segment Encoding Works

Each hex digit (0-F) needs a specific combination of the 7 segments lit to display it. That combination is packed into a single byte, one bit per segment — this calculator uses the common gfedcba bit order, where bit 0 (the least significant bit) controls segment a.

Full Hex Digit Reference

DigitSegments litByte (gfedcba)
0a b c d e f0x3F
1b c0x06
2a b d e g0x5B
3a b c d g0x4F
4b c f g0x66
5a c d f g0x6D
6a c d e f g0x7D
7a b c0x07
8a b c d e f g0x7F
9a b c d f g0x6F
Aa b c e f g0x77
bc d e f g0x7C
Ca d e f0x39
db c d e g0x5E
Ea d e f g0x79
Fa e f g0x71

Where Hex to 7-Segment Actually Comes Up

Writing a Lookup Table for an Embedded Display Driver

Microcontroller code that drives a 7-segment display directly (without a dedicated driver chip) needs a lookup table exactly like this one to convert each digit to its segment byte.

const uint8_t digitTable[16] = { 0x3F, 0x06, ... }

Debugging an Incorrectly Displayed Digit

When a 7-segment display shows the wrong pattern, comparing the byte your code is sending against the correct value from this table quickly identifies whether the bug is in the lookup table or elsewhere.

compare sent byte to expected 0x5B for digit 2

Converting Between Common-Cathode and Common-Anode

Taking a value from this common-cathode reference table and inverting it (bitwise NOT) to get the correct active-low value for a common-anode display.

common-anode byte = ~(common-cathode byte)

Why Use This Calculator Instead of Doing It by Hand

  • Converts a whole string of hex digits at once, not just one at a time
  • Full reference table alongside the calculator for looking up any digit directly
  • Runs entirely in your browser — nothing you type gets sent anywhere
  • Saves re-deriving the segment pattern for each digit from scratch

Limitations

  • Uses one specific encoding convention (common-cathode, active-high, gfedcba bit order) — other conventions exist, and common-anode displays need the bitwise inverse of these values.
  • Doesn't control the decimal point segment — most displays have an 8th segment for that, controlled separately from this table.

Frequently Asked Questions

What do the segment letters (a-g) refer to?

The 7 individual LED or LCD segments that make up a digit display, conventionally labeled a through g — a is the top segment, b and c are the upper-right and lower-right, and so on around the digit, with g being the middle segment.

What encoding convention does this use?

Common-cathode, active-high, with segments packed into a byte in gfedcba bit order (segment a is the least significant bit) — the most widely published convention in embedded systems references, though other conventions do exist.

What's the difference between common-cathode and common-anode?

Common-cathode displays light a segment when its control bit is 1 (active-high); common-anode displays are wired the opposite way, so lighting a segment needs a 0 (active-low) — a common-anode driver needs the bitwise inverse of this table's values.

Why do letters like B and D appear lowercase on a 7-segment display?

A 7-segment display physically can't distinguish uppercase B from 8, or uppercase D from 0 cleanly, so hex displays conventionally render b and d in a lowercase-style segment pattern to stay visually distinct from 8 and 0.