Number Base Converter

Bitwise Operations

Result (Decimal)

-

Result (Hex)

-

Result (Binary)

-

How to use this number base converter

  1. Type a number into any of the four fields.
  2. The other three bases update automatically as you type.
  3. Copy the result you need — useful for programming, color codes, or networking.

Why do computers use hexadecimal and binary?

Binary (base 2) directly reflects how computers store data as on/off bits. Hexadecimal (base 16) is a compact, human-friendly way to represent binary data, since each hex digit maps exactly to 4 bits — that's why you see it in color codes, memory addresses, and MAC addresses.

What is octal used for today?

Octal is less common now, but still appears in Unix/Linux file permission codes (like chmod 755) and some older programming contexts.

Is there a limit to how large a number I can convert?

This tool uses standard JavaScript number precision, which is reliable up to about 9 quadrillion (2^53). Beyond that, results may lose precision.

Why do bitwise operations behave oddly with large or negative numbers?

Bitwise operations (AND, OR, XOR, NOT, shifts) work on 32-bit signed integers in JavaScript, unlike the base converter above which handles much larger numbers — values outside that 32-bit range get truncated before the operation runs.

Two's complement — how computers actually represent negative numbers in binary

Binary has no built-in minus sign, so representing negative numbers requires a specific encoding scheme, and virtually every modern computer uses one called two's complement. To find a number's negative in two's complement, you invert every single bit (flipping every 0 to a 1 and every 1 to a 0) and then add 1 to the result. This specific scheme is exactly why the NOT operation shown above (bitwise inversion of a number's bits) doesn't simply produce that number's negative directly on its own — NOT alone is only the first of the two required steps; the "add 1" step is what completes the actual two's complement negation. Two's complement was specifically chosen as the near-universal standard because it lets ordinary addition circuits handle both positive and negative numbers using the exact same underlying hardware logic, without needing any separate, dedicated subtraction circuitry at all.

Why a single hex digit maps exactly, perfectly onto 4 binary bits

Hexadecimal's genuine practical usefulness for representing binary data comes down to one specific, elegant mathematical fact: 16 is exactly 2 to the 4th power, which means each individual hex digit (0-9, then A-F) corresponds precisely and exactly to a specific 4-bit binary pattern, with absolutely no remainder or overlap at the boundary. This clean, exact 4-bit grouping (commonly called a "nibble") is exactly why converting between binary and hex is pure, simple visual grouping rather than requiring any actual arithmetic at all — the binary sequence 1010 1111 converts directly to hex AF just by translating each 4-bit nibble to its single corresponding hex digit. Octal, by contrast, doesn't divide as cleanly, since 8 is 2 to the 3rd power, meaning octal groups bits in awkward, less-common threes rather than the far more common byte-aligned groups of four or eight — which is exactly why hex, not octal, became the dominant, standard choice for representing binary data in modern computing.

Bit shifting as fast multiplication and division by powers of two

Shifting a binary number's bits left or right isn't just a bit-manipulation curiosity — it has a genuine, direct mathematical meaning worth understanding. Shifting left by one position doubles the number's value (equivalent to multiplying by 2), and shifting left by n positions multiplies by 2^n. Shifting right similarly divides by powers of 2 (with the specific handling of any remainder depending on which particular shift variant is used). Historically, this made bit shifting a genuinely significant, real performance optimization, since shift operations execute considerably faster at the hardware level than full general-purpose multiplication or division circuits do. Modern compilers now automatically perform this exact substitution themselves when it's provably safe to do so, but shifting still remains directly, explicitly useful for tasks like efficiently packing multiple small values into a single larger integer, or extracting one specific, individual byte from within a larger multi-byte number.

Where these number bases and bitwise operations actually show up in real, everyday code

Beyond the color codes and file permissions already mentioned above, number bases and bitwise operations appear constantly throughout genuinely practical, everyday programming contexts. Bitwise flags let a single integer efficiently pack many independent true/false settings together, with each individual bit representing one specific option, and AND/OR operations used specifically to check or set those individual flags without disturbing any of the others sharing that same integer. Networking code uses bitwise AND with a subnet mask to determine which specific network a given IP address actually belongs to. Low-level graphics and color manipulation code frequently uses bit shifting specifically to pack separate red, green, blue, and alpha channel values together into one single combined 32-bit color integer. Far from being purely academic or theoretical, these specific operations remain genuinely everyday, practical tools across networking, graphics, embedded systems, and general low-level systems programming.

Limitations of this tool

As the FAQ above explains, the base converter uses standard JavaScript number precision, reliable up to about 9 quadrillion (2^53) — larger values may genuinely lose precision beyond that specific threshold. The bitwise operations section specifically operates on 32-bit signed integers, matching JavaScript's own native bitwise operator behavior, which is a meaningfully smaller range than the base converter above supports — values outside that 32-bit range get silently truncated before a bitwise operation actually runs, exactly as the FAQ notes. This tool doesn't currently support arbitrary custom bases beyond the four shown (decimal, hex, binary, octal), nor does it support arbitrary-precision "bignum" arithmetic beyond JavaScript's own standard native number precision limits.