Introduction to Number Systems: Decimal, Binary, Octal and Hexadecimal Explained

Share:

Digital 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.

Decimal, Binary, Octal, Hex Real Conversion Formulas Live Multi-Base Converter Real PLC Examples

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.

10
Decimal
0 1 2 3 4 5 6 7 8 9
2
Binary
0 1
8
Octal
0 1 2 3 4 5 6 7
16
Hexadecimal
0-9, A B C D E F
Advertisement
Advertisement

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.

Decimal to binary, the division method: Divide the decimal number by 2 repeatedly. Record each remainder (0 or 1). Keep dividing the quotient until it reaches 0. Read the remainders from bottom to top, that's your binary number.

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
Binary to decimal, the positional weight method: Multiply each binary digit by 2 raised to its position, counting from 0 on the right. Add up all the results.

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.

Video: "Number Systems Introduction, Decimal, Binary, Octal and Hexadecimal", embedded via YouTube
Advertisement
Advertisement

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.

Binary to octal, the 3-bit grouping method: Starting from the right, split the binary number into groups of 3 bits. Pad the leftmost group with zeros if needed. Convert each 3-bit group to its octal digit.

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.

Binary to hexadecimal, the 4-bit grouping method: Starting from the right, split the binary number into groups of 4 bits. Pad the leftmost group with zeros if needed. Convert each 4-bit group to its hex digit (0-9, then A-F).

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.

🔢
Number System Converter
Decimal, Binary, Octal, Hexadecimal, all at once
example 165
✔ Result
Decimal
Binary
Octal
Hex
Advertisement
Advertisement

Quick Reference: All Four Systems Side by Side

DecimalBinaryOctalHexadecimal
0000000
5010155
10101012A
15111117F
16510100101245A5

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 FamilyNative Numbering SystemWhy
AutomationDirect DirectLOGICOctal for memory addressingLegacy from early 12-bit and 24-bit processor architectures
Allen-Bradley (Rockwell)Hexadecimal for data and addressingClean 4-bit nibble alignment, easier to read in modern displays
MitsubishiHexadecimal, with octal in some legacy I/OHex dominates newer platforms, octal lingers in older I/O numbering
Most HMI displaysBCD (binary coded decimal)Reads like ordinary decimal on seven-segment style displays

Where This Actually Matters on the Job

🏭
PLC Memory Addressing

Reading and interpreting I/O addresses correctly for the specific PLC brand in use.

🔧
Troubleshooting Communication Data

Modbus and other protocols often display raw values in hex, needing quick mental conversion.

📊
Analog Signal Scaling

Raw ADC counts are binary values that must be converted and scaled to engineering units.

🖥
HMI and Display Formatting

BCD keeps operator displays readable without confusing binary values showing through.

🔌
Network Protocol Debugging

Packet captures and diagnostic tools commonly show raw data in hexadecimal.

💾
Memory and Register Sizing

Knowing bit, byte, and word sizes prevents overflow errors in counters and timers.

Quick FAQs: Number Systems

Why does hexadecimal use letters A through F?
Hexadecimal needs 16 unique digits, but our familiar decimal system only offers 10 symbols, 0 through 9. Once you run out of digits, the next six values, 10 through 15, get represented by the letters A through F instead.
Is BCD the same thing as binary?
No, and this trips people up constantly. BCD encodes each individual decimal digit using 4 bits, but only allows values 0 through 9 per group. Pure binary has no such restriction. For example, decimal 10 in binary is 1010, but in BCD it's written as two separate nibbles, 0001 0000.
Why can't I convert octal directly to hexadecimal in one step?
Octal groups bits in 3s and hex groups them in 4s, so the group boundaries don't line up cleanly between the two. The simplest reliable method is to convert octal to binary first, then regroup that same binary into 4-bit sets for hex.
How do PLCs represent negative numbers if there's no minus sign in binary?
Most systems use a method called two's complement. One bit, usually the leftmost, is reserved to indicate sign, and negative values are calculated by inverting all the bits of the positive number and adding one. It's a clever trick that lets normal binary addition work correctly even with negative numbers involved.
Do I really need to know this if my PLC software converts everything automatically?
Software handles the everyday conversion, that's true. But the moment something looks wrong, an unexpected value, a communication fault, an odd register reading, understanding what base you're actually looking at is often the fastest way to spot the real problem.

External References

Advertisement
Advertisement

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.
"I hope you like above blog. There is no cost associated in sharing the article in your social media. Thanks for Reading !! Happy Learning"

Leave a Reply

Your email address will not be published. Required fields are marked *