Decimal-Hex-Binary-Octal Converter
If you work with networking, Linux, Windows, microcontrollers, SDR, or low-level debugging, you’ll constantly run into numbers written in different bases—decimal in logs, hexadecimal in memory dumps, binary in bitmasks, and octal in classic Unix permissions. This quick converter lets you paste a value in almost any common format (including 0x, 0b, and 0o) and instantly see the equivalent representations, grouped bits/bytes, and optional signed (two’s complement) interpretation. It’s a practical tool for developers, sysadmins, and electronics enthusiasts who need fast, copy-ready results when decoding registers, flags, packet fields, or troubleshooting weird values in firmware and system output.
Paste a number in any format (e.g., 255, 0xFF, 0b1111, 0o377). Outputs update instantly.
Decimal
Hex
Binary
Octal
Advanced options
10101100 without 0b.
Bitwise & endian tools: for predictable results, select a bit width (8/16/32/64).
Bitwise operations
Bitwise result
Byte view & endianness
Understanding number bases in real-world tech work
When you build, debug, or optimize anything technical—software, firmware, networking gear, SDR receivers, Linux servers, or even audio interfaces—you eventually hit the same friction point: numbers don’t always show up in the base you “think” in. Logs tend to use decimal, memory dumps love hexadecimal, bitmasks are naturally binary, and Unix permissions still show up in octal. A base converter turns that constant mental translation into a one-second operation, which is exactly why these tools are used daily by developers, sysadmins, and electronics enthusiasts.
This guide explains what decimal, hexadecimal, binary, and octal actually represent, how to recognize them in the wild, and how to avoid common mistakes—especially around signed values, two’s complement, bit widths, and endianness.
Decimal vs binary vs hexadecimal vs octal
Decimal
Decimal (base-10) is the everyday number system. Digits range from 0–9, and each position represents a power of 10.
Example:
-
255means: 2×10² + 5×10¹ + 5×10⁰
In engineering work, decimal is common in user-facing UI, metrics, timing values, configuration limits, and bandwidth numbers like “1000 Mbps” or “5 ms”.
Binary
Binary (base-2) uses only digits 0 and 1, and each position represents a power of 2.
Example:
-
11111111₂means: 1×2⁷ + 1×2⁶ + … + 1×2⁰ = 255
Binary is the native language of:
-
bit flags and bitmasks
-
register maps and microcontroller peripherals
-
permissions, feature toggles, status words
-
DSP/SDR representations (bit depth, sample formats)
Binary is very explicit, but gets long quickly.
Hexadecimal
Hexadecimal (base-16) uses digits 0–9 and letters A–F (or a–f), representing values 10–15. Each position represents a power of 16.
Example:
-
FF₁₆equals 15×16¹ + 15×16⁰ = 240 + 15 = 255
Hex is popular because it maps neatly to binary:
-
1 hex digit = 4 bits (a “nibble”)
-
2 hex digits = 1 byte (8 bits)
That’s why memory dumps, MAC addresses, IPv6 hextets, CRCs, hashes, and register values commonly show up in hex.
Octal
Octal (base-8) uses digits 0–7. It’s less common today, but still extremely relevant in Unix-like systems.
Classic use:
-
file permissions such as
755,644,600
It’s also used in some older tooling and in certain representations where groups of 3 bits make sense (since 8 = 2³).
How to recognize number formats quickly
In practical systems, prefixes usually help:
-
0xFF→ hexadecimal (C/C++, Python, many tools) -
0b1010→ binary -
0o377→ octal (Python and some modern tools) -
077→ octal in some older languages and contexts (notably legacy C-style conventions)
Not everything uses prefixes. Some dumps show plain hex like:
-
DEADBEEF -
FFEE12
That’s why “bare binary” recognition can be useful if you frequently paste values like 10101100 without 0b. Still, it can be ambiguous because 10101100 could also be a decimal number—so it’s best treated as an optional behavior rather than a default.
Why engineers love grouping bits and bytes
Long binary strings are hard to read. Grouping improves readability dramatically:
-
Nibble grouping (4-bit chunks):
10101100→1010 1100 -
Byte grouping in hex (2-digit chunks):
DEADBEEF→DE AD BE EF
This matters when you debug:
-
protocol headers (fields aligned to bytes or nibbles)
-
microcontroller registers (bit fields)
-
packed structures and binary formats
A good converter will show grouping automatically, because it reduces mistakes—especially when you’re scanning a value visually.
Bit width: the missing piece in many conversions
One of the biggest sources of confusion is that computers don’t treat integers as “infinite length”. A value exists in a fixed number of bits: 8, 16, 32, 64… depending on the architecture, language, and data type.
For example, consider 0xFF:
-
In 8-bit unsigned:
0xFF= 255 -
In 8-bit signed:
0xFF= -1 (two’s complement) -
In 16-bit unsigned:
0x00FF= 255 -
In 16-bit signed: still 255, because the sign bit is 0
That’s why choosing the correct bit width is essential when interpreting values from:
-
hardware registers (often 8/16/32-bit)
-
network packets (fixed field sizes)
-
signed sensor readings
-
firmware structs and packed messages
When you select a width in a converter, it should apply “wrap modulo 2^N”, because that’s how real machine integers behave. This is the same reason you see wrap-around bugs in C when you overflow an unsigned integer.
Signed vs unsigned and two’s complement
The core idea
A binary pattern is just bits. Whether it’s “signed” or “unsigned” depends on interpretation.
-
Unsigned: all values represent 0 to 2^N – 1
-
Signed (two’s complement): values represent -2^(N-1) to 2^(N-1) – 1
Two’s complement is used almost everywhere in modern hardware and languages because it makes arithmetic efficient and consistent.
Quick mental rule
For N-bit signed integers:
-
If the most significant bit (MSB) is 0 → positive value
-
If MSB is 1 → negative value
Example in 8-bit:
-
0b01111111= 127 -
0b10000000= -128 -
0b11111111= -1
Converting two’s complement by hand
To interpret an N-bit value as signed:
-
If MSB = 0, it’s the same as unsigned.
-
If MSB = 1, subtract 2^N from the unsigned value.
Example:
-
8-bit
0xFF= 255 unsigned
Signed: 255 – 256 = -1
This rule is why a converter’s “signed interpretation” toggle is so useful: it lets you confirm what a negative value should be when you only have a hex or binary dump.
Practical examples you’ll actually see
Example 1: bit flags in a status register
Suppose a device status register is 0x2D and the datasheet says:
-
Bit 0: READY
-
Bit 2: ERROR
-
Bit 3: TX_ACTIVE
-
Bit 5: LOW_BAT
Convert 0x2D:
-
Hex
2D→ binary0010 1101
Now you can read:
-
bit 0 = 1 (READY)
-
bit 2 = 1 (ERROR)
-
bit 3 = 1 (TX_ACTIVE)
-
bit 5 = 1 (LOW_BAT)
This is exactly why grouped binary is powerful: it turns “magic hex” into human-readable state.
Example 2: decoding Unix permissions
Unix permissions are often shown in octal:
-
755means:-
owner: 7 →
rwx -
group: 5 →
r-x -
others: 5 →
r-x
-
Because each octal digit maps to 3 bits:
-
7 → 111
-
5 → 101
-
4 → 100
If you ever needed to explain “why 644 is typical for files”, it becomes obvious:
-
6 = 110 → rw-
-
4 = 100 → r–
-
4 = 100 → r–
Example 3: negative numbers from sensors
A temperature sensor might output a 16-bit signed value in a register. If you read:
-
0xFF9C
In 16-bit unsigned that’s 65436, which is nonsense as a temperature. In 16-bit signed:
-
0xFF9Cunsigned is 65436 -
65436 – 65536 = -100
Now it makes sense: maybe the unit is 0.01°C, so -100 means -1.00°C.
A converter that supports a 16-bit signed view saves time and mistakes.
Why “NOT”, shifts, AND/OR/XOR are useful in a converter
Bitwise operations show up everywhere in practical computing:
AND
Use AND to clear bits or test flags.
-
value & mask
Example:
-
mask to read lower 8 bits:
x & 0xFF
OR
Use OR to set bits.
-
value | mask
XOR
Use XOR to toggle bits, or compare patterns.
-
value ^ mask
NOT
NOT flips every bit in a fixed width.
-
In 8-bit: NOT
0x00→0xFF -
In 8-bit: NOT
0x0F→0xF0
Important detail: NOT only makes sense with a defined width. Without a width, two’s complement is conceptually infinite, so NOT becomes ambiguous. That’s why serious tools require an 8/16/32/64-bit selection for NOT.
Shifts
Shifts are used for:
-
scaling by powers of two
-
packing/unpacking fields
-
building masks
-
Left shift:
x << nmultiplies by 2^n (with wrap in fixed width) -
Logical right shift: shifts in zeros (unsigned)
-
Arithmetic right shift: preserves sign bit (signed)
If you ever had to decode a field like:
-
bits 12..15 are “mode”
You’d use a shift and mask: -
(value >> 12) & 0xF
That’s a real-world operation, not a theoretical one.
Endianness: why byte order matters
Endianness describes how multi-byte values are stored in memory or transmitted.
-
Big-endian: most significant byte first
-
Little-endian: least significant byte first
If you have a 32-bit value:
-
0x12345678
Big-endian bytes:
-
12 34 56 78
Little-endian bytes:
-
78 56 34 12
This matters because:
-
many CPUs store integers as little-endian (e.g., x86)
-
many network protocols are defined as big-endian (“network byte order”)
So you can see the same raw bytes interpreted differently depending on context. A converter that can show both byte views and swap endianness helps when you’re debugging:
-
packet captures
-
binary files
-
embedded memory dumps
-
cross-platform serialization bugs
Common mistakes and how to avoid them
Mistake 1: assuming hex implies “unsigned”
Hex is just a representation. The same bits can be signed or unsigned. If something looks “too large to be real”, check the signed interpretation with the correct bit width.
Mistake 2: forgetting the width when using NOT or shifts
Bitwise NOT and shift wrap behavior depends on width. In C, an 8-bit variable might be promoted to 32-bit during operations. In hardware, registers have exact sizes. Your converter should match the system you’re working with.
Mistake 3: mixing up ASCII, bytes, and numbers
ASCII is a character encoding. It’s common to interpret the lowest byte of a value as ASCII when debugging protocols, but don’t assume:
-
0x41= ‘A’ -
0x00is a null terminator -
many bytes are non-printable control values
ASCII mode is helpful, but it’s only one lens.
Mistake 4: thinking “0-prefixed numbers are always octal”
In some contexts (especially older C and old config formats), a leading zero implies octal. In many modern contexts, it does not. If you’re unsure, look for explicit prefixes like 0o, or check the tool/language documentation.
Mistake 5: assuming “bare 101010” is binary
It might be, or it might be decimal. That’s why “bare binary detection” should be optional.
Where base conversion shows up in everyday workflows
If you do any of these, you’ll use base conversion constantly:
-
Reading kernel logs or Windows event data where flags appear in hex
-
Debugging packet fields in Wireshark or raw captures
-
Working with microcontroller registers (GPIO, UART, SPI status bits)
-
Reverse engineering firmware or binary formats
-
Calculating subnet masks, bitmasks, and feature flags
-
Tuning SDR pipelines, DSP parameters, bit depths
-
Decoding audio interface status words or MIDI bytes
-
Handling CRCs, hashes, and checksums
It’s one of those “small” tools that saves huge time because it removes cognitive overhead and reduces errors.
Tips to get the most out of this converter
Use prefixes when you can
If you paste 0xFF, there’s no ambiguity. For raw binaries without a prefix, enable the “bare 0/1 as binary” option if that matches your workflow.
Select a width when working with hardware or protocols
Registers and fields are rarely “infinite”. Pick 8/16/32/64-bit so the tool shows:
-
correct wrap-around behavior
-
correct signed/unsigned values
-
stable byte and endianness representations
Use grouping for quick visual scanning
Nibble grouping in binary and byte grouping in hex match how most datasheets, packet diagrams, and memory dumps are presented.
Use bitwise tools to validate your logic
If you’re building masks or extracting fields, try the operation in the tool first:
-
AND with a mask
-
shift right to align a field
-
XOR to verify toggles
Shareable URLs for reproducible debugging
If you’re documenting a bug or sending a value to a teammate, URL syncing lets you share:
-
the input value
-
width and signed settings
-
bitwise operand and shift settings
This is extremely handy when writing bug reports, documentation, or internal notes.
Image(s) used in this article are either AI-generated or sourced from royalty-free platforms like Pixabay or Pexels.






