๐Ÿงฎ Hex / Decimal / Binary Size Converter

Last updated: December 13, 2025

Hex / Decimal / Binary Converter

Enter decimal (255), hex (FF or 0xFF), or binary (0b11001100 or 11001100)
Decimal โ€”
Hexadecimal โ€”
Octal โ€”
Binary โ€”
Grouped Bin โ€”
Size / Info โ€”
Bit usage

Why Hex, Decimal, and Binary Still Matter in a World of GUIs

Open any hex editor and the first thing you notice is that the file you thought you understood โ€” a JPEG, an EXE, a compiled shader binary โ€” is now a grid of two-character codes. FF D8 FF E0. To the uninitiated it looks like encrypted nonsense. To anyone who has spent time in low-level system work, those four bytes are immediately recognizable as the JPEG magic number, a signature baked into the first four bytes of every standard JPEG file on the planet. Reading those codes fluently โ€” converting them to decimal, mapping them to bit patterns โ€” is a skill that separates developers who truly understand their tools from those who only use them.

The three numeral systems โ€” decimal, hexadecimal, and binary โ€” are not arbitrary choices. Each one maps cleanly onto a different layer of how computers store and manipulate data.

Binary: The Language the Silicon Actually Speaks

Binary is not an abstraction. Every transistor in a processor is either allowing current to flow or blocking it. On or off. One or zero. When you look at the binary representation of a number, you are as close as software gets to seeing the physical state of memory. The number 255 in binary is 11111111 โ€” eight bits, all set. That is one full byte at maximum capacity. The number 4096 becomes 1000000000000 โ€” a single bit set in the thirteenth position, which tells you immediately that this is exactly 2ยนยฒ, a power of two, and therefore almost certainly a page size, a sector boundary, or a buffer alignment in disguise.

Binary arithmetic is also where bitwise operations live. When a C programmer writes flags & 0x04 to test whether a permission bit is set, they are checking whether the third bit in a byte is 1. You cannot reason about that quickly without being able to visualize the binary form. Converting between binary and the other bases is not busywork โ€” it is the mental model that makes bitmasking, flag registers, and protocol field parsing readable rather than mysterious.

Hexadecimal: The Compression That Actually Works

Binary has one significant practical problem: it gets long fast. A 32-bit memory address written in binary is 32 characters of 1s and 0s. Nobody reads that reliably. Decimal is shorter but the relationship between decimal and binary is awkward โ€” converting between them requires repeated division and is not something most people can do mentally at speed.

Hexadecimal solves this with an elegant property: every hex digit maps exactly to four binary digits (a nibble). Two hex digits map to exactly one byte. So 0xFF is 11111111, full stop. 0x1A3F is the 16-bit value made of nibbles 0001 1010 0011 1111. The translation is mechanical โ€” no arithmetic required once you memorize the mapping. This is why every debugger, every memory profiler, every network protocol analyzer, and every microcontroller reference manual expresses addresses and values in hex. It is dense, unambiguous, and trivially reversible to binary.

FAT32 file systems store cluster counts in hex. ELF binary headers encode section offsets in hex. TCP packets mark flags in hex. RGBA color values in CSS are hex. IPv6 addresses are eight groups of four hex digits. Once you start noticing, hexadecimal is everywhere that humans need to talk about raw machine values without going mad reading binary strings.

Decimal: Where Human Intent Lives

Decimal is the format we reach for when we want to communicate something to a person rather than a machine. A file that is 1,048,576 bytes is technically 0x100000 in hex or 100000000000000000000 in binary, but we say "one megabyte" โ€” which is 1024ยฒ in decimal โ€” because decimal is the system humans use natively. File size displays, progress bars, database record counts: these all live in decimal because the humans reading them use decimal arithmetic.

The tension between decimal human-readability and binary machine-reality produces the persistent confusion around kilobytes versus kibibytes. When hard drive manufacturers say "500 GB" they mean 500 ร— 10โน bytes โ€” a clean decimal number. When your OS reports the same drive as "465.7 GiB" it is dividing by 2ยณโฐ, the binary definition. The mismatch is not dishonesty; it is a collision between two different numbering philosophies applied to the same physical object.

File Signatures and the Practical Value of Quick Conversion

Learning to convert between these three bases pays immediate dividends in file forensics and reverse engineering. PNG files start with 89 50 4E 47 in hex โ€” which in ASCII decodes to .PNG (the 0x89 is a non-ASCII byte intentionally placed to catch transmission stripping). EXE files start with 4D 5A โ€” "MZ" in ASCII, initials of Mark Zeilber, one of the DOS architects. ZIP files start with 50 4B 03 04 โ€” "PK", for Phil Katz, the creator of PKZIP.

Recognizing these signatures requires comfortable movement between hex and decimal. When a file recovery tool says it found a potential JPEG at byte offset 0x1F400, you need to know that is decimal 128,000 โ€” the 125th sector of a 512-byte-sector drive โ€” to understand whether that makes sense in the context of the file system layout you are examining.

Alignment, Masks, and the Joy of Powers of Two

In memory management, values that are powers of two have special significance. Page sizes (typically 4,096 bytes = 0x1000 = 2ยนยฒ), cache line sizes (typically 64 bytes = 0x40 = 2โถ), and DMA buffer alignments all come in powers-of-two sizes because processors can test and mask these boundaries with a single bitwise AND operation rather than a modulo division. When you are debugging a segmentation fault that only occurs at certain memory addresses, or trying to understand why a memory allocator is padding structures to seemingly arbitrary sizes, the ability to instantly recognize that 0x40, 0x80, 0x100, 0x200 are all powers of two โ€” and therefore boundary or alignment values โ€” is not optional. It is the difference between a debugging session that takes ten minutes and one that takes three hours.

Building Fluency: How the Conversion Actually Works

The mechanics of conversion are worth understanding rather than just delegating to a tool. Hex to binary: replace each hex digit with its 4-bit binary equivalent (A โ†’ 1010, F โ†’ 1111, etc.). Binary to decimal: sum each bit position's power of two where the bit is 1. Decimal to hex: repeatedly divide by 16, recording remainders โ€” the remainders in reverse give you the hex digits.

Most experienced developers can do single-byte conversions (0โ€“255) mentally. The hex value 0xC0 is instantly recognizable as 192 โ€” the start of the old Class C IPv4 range โ€” and as binary 11000000 with the top two bits set, which is also the signature of a two-byte UTF-8 sequence. That kind of pattern recognition only develops through repeated manual conversion, and it makes reading low-level documentation substantially faster.

Tools that perform these conversions โ€” particularly ones that also display the grouped binary representation, the minimum word width required, and byte-size labels โ€” collapse the tedious arithmetic and let you focus on the meaning of the values rather than the mechanics of the conversion. The point is not to avoid learning the underlying system; it is to move through the bookkeeping quickly so the analytical work can happen faster.

Whether you are writing a device driver, parsing a binary protocol, working through a CTF challenge, or simply trying to understand what your compiler has done to a struct, hex-decimal-binary conversion is one of those foundational skills that never stops being relevant. The numbering systems are different lenses on the same underlying data, and switching between them fluidly is what makes the data legible.

FAQ

How do I enter a hexadecimal value โ€” do I need the 0x prefix?
You can enter hex values with or without the 0x prefix (e.g., both 'FF' and '0xFF' work). If you use auto-detect mode and your value contains letters Aโ€“F, the tool treats it as hexadecimal. For pure numeric values like '255' that could be either decimal or hex, select the base manually to avoid ambiguity.
What does the 'Grouped Binary' output show?
Grouped binary displays the full binary representation split into chunks โ€” nibbles (4 bits), bytes (8 bits), or words (16 bits) โ€” separated by spaces. For example, decimal 255 as a grouped byte is '11111111', and 65535 grouped by byte is '11111111 11111111'. This makes it much easier to read the bit pattern and identify which bits are set in each segment.
Why does the tool show a 'minimum word size'?
The minimum word size tells you the smallest standard integer type (8, 16, 32, or 64 bits) that can hold the value without overflow. For example, decimal 300 needs at least 9 bits, so the minimum word is 16-bit โ€” you cannot store it in a uint8_t. This is useful when choosing integer types in C, C++, or assembly to avoid accidental truncation.
The tool detected my binary string as something else โ€” what happened?
Auto-detection of binary strings that contain only 0s and 1s is inherently ambiguous (is '1010' the decimal number ten-ten or the binary number ten?). The tool uses a heuristic: strings of only 0s and 1s with a length that is a multiple of 4 and no longer than 32 digits are treated as binary. For reliable results, use the '0b' prefix (e.g., '0b1010') or select 'Binary (base 2)' from the base dropdown.
What is the largest value this converter can handle?
The converter handles values up to 2^53 โˆ’ 1 (9,007,199,254,740,991), which is JavaScript's maximum safe integer. This covers all 32-bit values and most 48-bit values, which is sufficient for the vast majority of file offsets, memory addresses, and protocol field values. For 64-bit values that exceed this limit, a language-native BigInt implementation would be required.
Why does it also show an ASCII character for some values?
When the decimal value falls between 32 and 126 (the printable ASCII range), the tool shows the corresponding character alongside the other outputs. This is useful when analyzing file headers, protocol buffers, or binary data streams where byte values often encode ASCII characters โ€” for instance, 0x50 = 80 = 'P', which immediately suggests the 'PK' ZIP file signature.