Table of Contents
ToggleDigital Electronics · PLC Fundamentals · Number Systems
Introduction to Number Systems: Decimal, Binary, Octal and Hexadecimal Explained
Have you ever wondered why a PLC manual suddenly starts talking about hex addresses instead of plain numbers? This guide walks through decimal, binary, octal, and hexadecimal in plain language, with real conversion formulas, a live converter, and examples straight from real automation systems.
Why Do We Even Need More Than One Number System?
Suppose someone handed you a light switch and asked you to count how many times you flicked it. You'd naturally use decimal, 1, 2, 3, and so on. Now suppose that switch is actually a transistor inside a PLC, switching millions of times a second. Decimal stops being useful, and a completely different way of counting takes over.
We count in tens because, quite literally, we have ten fingers. That's decimal, base 10, and it's so natural to us that we rarely stop to think of it as a choice at all. But a PLC, a microcontroller, or any digital circuit doesn't have fingers. It has transistors, and a transistor only really understands two states clearly: current flowing, or current not flowing. On or off. That's it. So computers and PLCs settled on a number system built around exactly two digits, binary, base 2.
Here's the catch. Binary numbers get long, fast. A decimal number like 200 becomes 11001000 in binary, eight digits just to represent three. Now imagine reading pages of PLC memory addresses like that. It would be exhausting and genuinely error prone. So engineers came up with two shortcuts, octal (base 8) and hexadecimal (base 16), specifically because they compress binary into something a human can actually read comfortably, while still translating back to binary perfectly, digit for digit.
Decimal: The System You Already Know By Heart
Decimal is a positional system. That just means where a digit sits matters as much as what the digit actually is. Take the number 453. The 4 isn't just "four", it's four hundreds. The 5 is five tens. The 3 is three ones. Written properly, that's (4 × 10²) + (5 × 10¹) + (3 × 10⁰). Every number system we're about to look at, binary, octal, hexadecimal, works on this exact same positional idea. Only the base changes.
Binary: What a PLC Actually Understands
Binary uses only two digits, 0 and 1. Each one is called a bit, short for binary digit. Group four bits together and you get a nibble. Group eight bits, or two nibbles, and you get a byte. Sixteen bits, or two bytes, make up a word, which happens to be exactly the register size most PLCs use internally. Thirty two bits make a double word.
For example, a single 16-bit PLC word filled entirely with 1s represents the decimal number 65,535. That's the practical ceiling of what one basic PLC register can hold, and it's exactly why programmers care about data type sizes when storing large counts or timer values.
Suppose we convert decimal 25 to binary: 25 ÷ 2 = 12 remainder 1 12 ÷ 2 = 6 remainder 0 6 ÷ 2 = 3 remainder 0 3 ÷ 2 = 1 remainder 1 1 ÷ 2 = 0 remainder 1 Reading bottom to top: 25 in decimal = 11001 in binary
Suppose we convert binary 11001 back to decimal: 1×2⁴ + 1×2³ + 0×2² + 0×2¹ + 1×2⁰ = 16 + 8 + 0 + 0 + 1 = 25 Confirmed, we're back to decimal 25
Watch: Number Systems Introduction, Decimal, Binary, Octal and Hexadecimal
This video walks through the same conversions covered above with additional worked examples.
Octal: Binary's Older, Simpler Shorthand
Octal groups binary digits into sets of three, since 2³ equals 8, matching octal's eight digits perfectly. This made octal genuinely convenient in early computing, when many systems naturally worked in groups of 12 or 24 bits. Some PLC families still carry this legacy today, for instance AutomationDirect's DirectLOGIC series addresses its memory in octal, a detail that surprises engineers used to newer hex-based systems.
Suppose we convert binary 111010011 to octal: Group in 3s from the right: 111 | 010 | 011 111 = 7, 010 = 2, 011 = 3 Result: 723 in octal
Hexadecimal: The System Most Modern PLCs Actually Speak
Hex groups binary into sets of four, since 2⁴ equals 16. That's a perfect match to a nibble, which is exactly why hex became the go-to shorthand in modern computing and automation. Brands like Allen-Bradley and Mitsubishi lean heavily on hexadecimal for memory addressing and data display, precisely because one hex digit maps cleanly onto exactly four binary digits, no remainder, no awkward grouping.
Suppose we convert binary 10100101 to hex: Group in 4s: 1010 | 0101 1010 = A, 0101 = 5 Result: A5 in hexadecimal Verify: A5(16) = (10×16¹) + (5×16⁰) = 160 + 5 = 165 in decimal
BCD: A Fifth System Worth Knowing, Even If It's Not a "Real" Base
Have you ever looked at a seven-segment display on an old PLC panel and wondered how it shows plain decimal digits when the processor underneath only speaks binary? That's Binary Coded Decimal, or BCD, doing its job. BCD isn't really a new base at all. It takes each individual decimal digit, one at a time, and encodes just that single digit using 4 bits.
Suppose we want to represent decimal 165 in BCD. We don't convert the whole number to binary at once. Instead, each digit gets its own 4-bit group: 1 becomes 0001, 6 becomes 0110, and 5 becomes 0101. Strung together, that's 000101100101. Compare that to true binary, where 165 is simply 10100101, noticeably shorter. BCD trades that compactness for something else, human readability, since each group maps directly back to a familiar decimal digit without any extra conversion step.
There's a genuine gotcha here worth remembering. BCD only allows the bit patterns for 0 through 9 in each 4-bit group. The patterns for 10 through 15, the same ones hexadecimal happily uses as A through F, are simply invalid in BCD. Feed an invalid BCD pattern into certain PLC instructions, and some processors will flag a fault rather than guess at what you meant.
Try It Yourself: Live Number System Converter
Enter a number in any base below, and watch it convert to all four systems instantly.
Quick Reference: All Four Systems Side by Side
| Decimal | Binary | Octal | Hexadecimal |
|---|---|---|---|
| 0 | 0000 | 0 | 0 |
| 5 | 0101 | 5 | 5 |
| 10 | 1010 | 12 | A |
| 15 | 1111 | 17 | F |
| 165 | 10100101 | 245 | A5 |
Have you ever noticed how the same value looks completely different depending on which system you write it in? That's exactly the point, and exactly why a PLC address label like "A5" only makes sense once you know it's being read in hex, not decimal.
Which Number System Does Your PLC Actually Use?
| PLC Family | Native Numbering System | Why |
|---|---|---|
| AutomationDirect DirectLOGIC | Octal for memory addressing | Legacy from early 12-bit and 24-bit processor architectures |
| Allen-Bradley (Rockwell) | Hexadecimal for data and addressing | Clean 4-bit nibble alignment, easier to read in modern displays |
| Mitsubishi | Hexadecimal, with octal in some legacy I/O | Hex dominates newer platforms, octal lingers in older I/O numbering |
| Most HMI displays | BCD (binary coded decimal) | Reads like ordinary decimal on seven-segment style displays |
Where This Actually Matters on the Job
Reading and interpreting I/O addresses correctly for the specific PLC brand in use.
Modbus and other protocols often display raw values in hex, needing quick mental conversion.
Raw ADC counts are binary values that must be converted and scaled to engineering units.
BCD keeps operator displays readable without confusing binary values showing through.
Packet captures and diagnostic tools commonly show raw data in hexadecimal.
Knowing bit, byte, and word sizes prevents overflow errors in counters and timers.
Quick FAQs: Number Systems
External References
- GeeksforGeeks: Base Conversions for Number Systems
- AutomationDirect: Numbering Systems Explained
- AutomationDirect: DL405 User Manual, Numbering Systems Appendix
What we learn today
- Every number system, decimal, binary, octal, and hexadecimal, works on the same positional idea, only the base changes.
- Binary exists because a PLC's transistors only reliably recognize two states, on and off, nothing in between.
- Octal and hexadecimal exist purely as human-friendly shorthand, compressing long binary strings into something readable, while still converting back perfectly.
- Real PLC brands genuinely differ in which system they default to, so knowing this isn't just theory, it directly affects how you read addresses and data on the job.
