HomeUtilitiesArbitrary-Precision Number Base Converter

Arbitrary-Precision Number Base Converter

Convert numbers of any size between Binary, Octal, Decimal, Hexadecimal, and any custom base (2-36). Features fractional float conversion, signed two's complement representations, step-by-step conversions, and an interactive 32-bit visualization grid.

Convert numbers of any size between Binary, Octal, Decimal, Hexadecimal, and any custom base (2-36). Features fractional float conversion, signed two's complement representations, step-by-step conversions, and an interactive 32-bit visualization grid.

This tool is designed to provide a seamless experience for developers by handling complex operations directly in your browser with maximum speed and security.

100% Private
Instant Results
Customizable
Offline Ready
Dev-Friendly
Easy Export

A number base (or radix) defines how many unique digits a numeral system uses and what positional value each digit position represents. Decimal (base 10) — the system humans use naturally — has ten digits (0-9) and each position to the left is ten times the value of the position to its right. Binary (base 2) has only two digits (0 and 1) and each position is twice the value of the position to its right. A binary number like 1010 represents 1×8 + 0×4 + 1×2 + 0×1 = 10 in decimal. All modern computers process information in binary at the hardware level because transistors have two states: on (1) and off (0).

Hexadecimal (base 16) uses sixteen symbols: the digits 0-9 and the letters A-F where A=10, B=11, C=12, D=13, E=14, F=15. Each hex digit represents exactly four binary digits (bits) — this neat relationship is why hex is the preferred compact representation for binary data. A single byte (8 bits) takes 8 binary digits to write (11111111) but only 2 hex digits (FF). Memory addresses, color codes, MAC addresses, hash digests, and error codes in operating systems are all displayed in hex because it is compact and directly maps to the underlying binary representation. The hex value 0x1A3F maps to binary 0001101000111111 — two characters per byte versus eight. Octal (base 8) uses digits 0-7. Each octal digit represents exactly three binary bits. Octal is less common in modern software but appears consistently in Unix file permissions — the chmod value 755 is an octal number where each digit represents the read (4), write (2), and execute (1) permission bits for owner, group, and others.

Understanding these representations is not just academic for programmers. When you see a memory address in a debugger, an error code in a kernel log, a color value in a CSS file, a bitmask for flag checking, or a Unix permission string — you are reading data that is meaningful in a specific base. Converting between them quickly is a daily task in low-level programming, embedded systems, network engineering, and security work.

This tool converts any number between all four common numeral bases simultaneously. Enter a number in any base — Decimal, Binary, Octal, or Hexadecimal — and the tool instantly computes and displays all four representations side by side. You do not need to know the source base before converting: select the input base from the dropdown, enter your number, and all four outputs update immediately. The four output panels show Binary (base 2, digits 0-1), Octal (base 8, digits 0-7), Decimal (base 10, digits 0-9), and Hexadecimal (base 16, digits 0-9 and A-F). Each output has its own copy button so you can copy exactly the representation you need without selecting text manually. The tool handles large numbers using arbitrary precision arithmetic — you are not limited to the 32-bit or 64-bit integer range that constrains most programming language built-in conversion functions. The input field validates the digits as you type based on the selected source base — entering a digit that is invalid for the selected base (like the digit 9 in a binary input, or the letter G in a hex input) shows an error immediately rather than silently producing a wrong result. This real-time validation prevents the most common base conversion mistake: entering a number in the wrong base and not realizing it because the converter accepted it without complaint.

1. Select the source base from the dropdown next to the Input Number field — choose BASE 2 (BINARY) if entering a binary number, BASE 8 (OCTAL) for octal, BASE 10 (DECIMAL) for a standard decimal number, or BASE 16 (HEX) if entering a hexadecimal value. The selected base tells the tool which numeral system your input is in so it converts correctly to all other bases.

2. Enter your number in the Input Number field — type the digits valid for the selected base. Binary only accepts 0 and 1. Octal accepts 0-7. Decimal accepts 0-9. Hexadecimal accepts 0-9 and A-F (case-insensitive). The tool validates your input in real time and shows an error if you enter a digit that is not valid for the selected base.

3. Read all four output values simultaneously — the Binary, Octal, Decimal, and Hexadecimal panels all update instantly as you type. You do not need to click a Convert button. The four representations of your input number are always visible at the same time, making it easy to compare them and understand how the same value looks in each numeral system.

4. Click the copy icon on any output panel to copy that specific representation to your clipboard — copy just the hex value if you need it for a CSS color or memory address, just the binary value if you need it for a bitmask analysis, or just the decimal value for numeric comparison. Each panel copies independently.

5. For the reverse direction: if you have a result you want to convert further — for example you have a hex result and want to see it in octal — change the source base dropdown to BASE 16 (HEX), clear the input, and enter the hex value. The tool reconverts from hex as the source, giving you all four representations with hex as the input.

The scenarios where I reach for a base converter come up constantly in systems-level work. Reading a kernel error code in hex and needing the decimal value to look it up in documentation. Checking whether a bitmask value in a configuration file has the correct bits set by looking at the binary representation. Converting a chmod permission value from octal to binary to verify which permission bits are set. Writing a byte value in assembly or C where the language accepts hex literals (0xFF) and you need to know the decimal equivalent. Setting an IP subnet mask in CIDR notation and needing to verify the binary pattern. CSS color values are one of the most frequent base conversions for web developers. The color #29965A is a hex value — each pair of hex digits represents one byte of the red, green, and blue channels. 29 in hex is 41 in decimal (the red channel intensity), 96 is 150 (green), and 5A is 90 (blue). When a designer gives you a Figma color code and you need to adjust the individual channel intensities in a color manipulation function that takes decimal 0-255 values, you convert the hex pairs to decimal. When you compute a color value in code and need to verify it matches the hex code in the design, you convert decimal back to hex. For developers learning computer science fundamentals — data representation, bitwise operations, networking, operating systems — having a live base converter is essential for intuition-building. The connection between the binary representation and the hex representation, the way the bit pattern of 255 (11111111) maps to FF in hex, the way Unix permission 755 breaks into owner (7 = 111 = rwx), group (5 = 101 = r-x), and others (5 = 101 = r-x) — these patterns become immediately concrete when you can convert them interactively rather than working through them by hand.

Simultaneous all-four-base conversion — Binary Octal Decimal and Hexadecimal all display at once with no need to convert one pair at a time

Real-time updates — all four outputs update instantly as you type with no Convert button required

Input validation per base — invalid digits for the selected base are rejected immediately preventing silent conversion errors from entering wrong-base digits

Arbitrary precision — handles large numbers beyond the 32-bit and 64-bit integer limits that constrain most programming language built-in conversion functions

Individual copy buttons — each output panel has its own copy button so you can copy exactly the representation you need without text selection

Select source base — convert from any of the four bases as the input not just decimal making it easy to convert hex to octal or binary to hex

100% browser-based — all conversion runs locally using JavaScript with no server round-trip

Instant and always-on — conversions appear as you type not after clicking a button making it faster for rapid lookup during debugging or code review

Converting kernel error codes or memory addresses from hexadecimal to decimal for documentation lookup

Checking whether a bitmask value has the correct bits set by viewing its binary representation

Converting Unix file permission values (chmod) from octal to binary to verify read write execute bits

Converting CSS hex color values to decimal RGB channel values for use in color manipulation functions

Checking large integer values in their binary representation to understand bit patterns for low-level programming

Converting network subnet masks and IP address octets between binary and decimal

Converting ASCII character codes between decimal and hexadecimal for encoding and debugging

Learning number base conversions for computer science courses by seeing all four representations simultaneously

Example Input

255

Example Output

Decimal:     255
Binary:      11111111  (8 bits, all set — one full byte at maximum value)
Octal:       377
Hexadecimal: FF        (0xFF — two hex digits, each representing 4 bits)

Note: 255 is the maximum value for an unsigned byte (uint8).
It appears as 0xFF in C/C++ hex literals, as #FF in CSS hex colors,
and as 11111111 in binary bitmask operations.

Invalid Character for Base: Each numeral base only accepts specific digits. Binary (base 2) accepts only 0 and 1. Octal (base 8) accepts 0 through 7. Decimal (base 10) accepts 0 through 9. Hexadecimal (base 16) accepts 0-9 and the letters A through F (uppercase or lowercase). If you enter an invalid character — like the digit 2 in binary, the digit 8 in octal, or the letter G in hexadecimal — the tool reports an error for that specific character. Remove the invalid character or select the correct source base for the number you are entering.

Empty Input: The tool requires at least one digit to perform a conversion. If the input field is empty, no output is displayed. Type or paste a number in the selected base to see the conversions. For a quick demonstration, click Load Example to populate the field with a sample number.

Entering a Decimal Number with the Wrong Base Selected: The most common mistake is entering a standard decimal number like 255 with the source base set to Binary or Hex, which gives completely wrong conversion results. For example, entering 255 with base set to Hexadecimal converts 0x255 (hex) to decimal 597 — not 255 decimal. Always verify the source base dropdown matches the numeral system of the number you are entering before reading the conversion results.

Hex Input Missing the 0x Prefix Confusion: Hexadecimal numbers are often written with a 0x prefix in code (0xFF, 0x1A3F) or with a # prefix in CSS (#FF5733). This tool expects hex digits only — enter FF not 0xFF and not #FF. The 0x and # are notation conventions not part of the hex number itself. If you paste a hex value with a prefix, remove the prefix before entering it into the hex input field.

Large Binary Numbers That Appear Correct But Are Off By One: When working with binary representations of signed integers, the most significant bit (leftmost bit) is the sign bit in two's complement representation — 1 means negative. The binary number 10000000 is not 128 decimal in a signed 8-bit context — it is -128. This tool converts as unsigned integers (treating all bits as magnitude, not sign). If you are working with signed binary integers and the decimal result looks wrong by a factor of 2 or appears negative when you expect positive, you may need to account for two's complement sign interpretation.

Confusing the base of a number from context when no prefix is provided

Fix: A number string like '10' means different things in different bases: 10 decimal = ten, 10 binary = two, 10 octal = eight, 10 hexadecimal = sixteen. Without a base indicator, the interpretation is ambiguous. In code, languages use prefixes to disambiguate: 0b10 is binary 2, 010 is octal 8 (in C/C++/Python 2 — Python 3 uses 0o10), 0x10 is hex 16. When someone gives you a number without indicating the base, ask which base they mean or check the context — a MAC address is always hex, a Unix permission value is always octal, a bitmask in C code is typically hex. In this tool, always verify you have selected the correct source base before trusting the conversion result.

Using octal literals in JavaScript (leading zero) and getting unexpected results

Fix: In JavaScript, a numeric literal with a leading zero like 0755 is interpreted as an octal number (485 in decimal) in non-strict mode. This is a legacy behavior that causes bugs when developers write permission values or IDs with leading zeros not intending them to be octal. In strict mode ('use strict') JavaScript throws an error for octal literals. ES6 introduced the 0o prefix for explicit octal: 0o755 is correctly parsed as octal 755. When converting Unix permission values in JavaScript code, always use the 0o prefix or pass the permission as a string to parseInt('755', 8) to explicitly parse as octal. Never rely on leading-zero octal parsing in JavaScript.

Treating hex color codes as single numbers rather than three separate byte values

Fix: A CSS hex color like #29965A is not a single hexadecimal number to convert to decimal. It is three separate one-byte values: 29 (red), 96 (green), 5A (blue). Each pair of hex digits represents one color channel with a value between 0x00 (0) and 0xFF (255). To find the decimal value of the red channel, convert just the first two hex digits (29) to decimal (41), not the entire six-digit string. When working with hex colors in code, split the string into three two-character pairs and convert each pair independently: parseInt('29', 16) = 41, parseInt('96', 16) = 150, parseInt('5A', 16) = 90.

Performing base conversion by hand and making positional value errors

Fix: Manual base conversion is error-prone because the positional value of each digit depends on its position and the base. In binary, positions from right to left are 1, 2, 4, 8, 16, 32, 64, 128 — powers of 2. In hex, positions from right to left are 1, 16, 256, 4096 — powers of 16. A common error is adding or multiplying the wrong power. For example, converting binary 1011 by hand: 1×8 + 0×4 + 1×2 + 1×1 = 8+0+2+1 = 11 decimal. Getting 8+4+2+1 = 15 is wrong because the 0 in position 2 was incorrectly counted as 1. Use this tool for any conversion where precision matters — hand conversion is fine for learning but unreliable for production use.

Using parseInt() in JavaScript without specifying the radix for non-decimal bases

Fix: JavaScript's parseInt() function takes an optional second argument for the radix (base). parseInt('FF') without a radix returns NaN in strict implementations and may return a wrong value in lenient ones. parseInt('FF', 16) correctly returns 255. parseInt('11111111', 2) correctly returns 255. parseInt('377', 8) correctly returns 255. Always specify the radix when using parseInt() for base conversion in JavaScript code. For the reverse direction, use number.toString(base): (255).toString(16) returns 'ff', (255).toString(2) returns '11111111', (255).toString(8) returns '377'.

What bases are supported?

The tool supports the four most commonly used numeral bases: Binary (base 2, digits 0-1), Octal (base 8, digits 0-7), Decimal (base 10, digits 0-9), and Hexadecimal (base 16, digits 0-9 and A-F). These cover the vast majority of base conversion needs in programming, computer science, and engineering. All four are displayed simultaneously — entering a number in any one base shows all four representations at once without needing to convert them separately.

Can it handle large numbers?

Yes. The tool uses arbitrary precision arithmetic rather than JavaScript's built-in 32-bit or 64-bit integer types. This means you can convert numbers larger than 2^53 (the limit of JavaScript's safe integer range) and larger than 2^64 (the limit of a 64-bit unsigned integer) without loss of precision. For typical programming use cases — converting memory addresses, hash values, permission bitmasks, and color codes — this is more than sufficient. Very large numbers (hundreds of digits) are handled correctly though computation may take a moment longer.

Why do programmers use hexadecimal?

Hex is used because it maps cleanly to binary: each hex digit represents exactly 4 binary bits. One byte (8 bits) takes 8 characters to write in binary but only 2 hex characters. This makes hex significantly more compact and readable than binary for large bit patterns. A 32-bit memory address takes 32 binary digits (0000000000000000000000000001101) but only 8 hex digits (0000000D). Memory addresses, color values, MAC addresses, cryptographic hashes, and machine instruction encodings are all displayed in hex for this reason. When you see 0xFF in C code or #FF5733 in CSS, you are reading hex.

What is octal used for?

Octal is most commonly encountered in Unix/Linux file permissions. The chmod command uses octal notation where each octal digit represents three permission bits for owner, group, and others. The digit 7 (binary 111) means read+write+execute, 5 (binary 101) means read+execute, 4 (binary 100) means read only, 0 (binary 000) means no permissions. chmod 755 sets owner permissions to rwx (7) and group/others to r-x (5). Understanding octal in this context means understanding the three binary bits each digit represents. Octal also appears in some older computing contexts and in certain bitfield representations.

How do I convert between bases in code?

In JavaScript: parseInt('FF', 16) converts hex FF to decimal 255. parseInt('11111111', 2) converts binary to decimal. (255).toString(16) converts decimal to hex ('ff'). (255).toString(2) converts to binary ('11111111'). In Python: int('FF', 16) converts hex to decimal. int('11111111', 2) converts binary to decimal. hex(255) returns '0xff'. bin(255) returns '0b11111111'. oct(255) returns '0o377'. In Java: Integer.parseInt('FF', 16) converts hex to decimal int. Integer.toBinaryString(255) converts to binary string. In C/C++: use printf with %d for decimal, %x for hex, %o for octal, %b for binary (non-standard, use custom function or bitwise loop).

What is two's complement and how does it affect binary conversion?

Two's complement is the standard way computers represent negative integers in binary. In a signed 8-bit integer, the most significant bit (leftmost) is the sign bit — 0 means positive, 1 means negative. The number -1 in 8-bit two's complement is 11111111 (all ones). The range of a signed 8-bit integer is -128 to +127. This tool converts as unsigned integers — 11111111 converts to decimal 255, not -1. If you are working with signed integers and the binary representation has a leading 1, the decimal equivalent this tool shows is the unsigned interpretation. For signed interpretation, subtract 2^n (where n is the bit width) from the unsigned result if the leading bit is 1.

What is the difference between binary and hexadecimal in CPU architecture?

At the hardware level, CPUs operate entirely in binary — all data and instructions are streams of 0s and 1s processed by logic gates. Hexadecimal is a human-readable representation of binary used in tooling, debuggers, and documentation because it is much more compact. A 64-bit CPU register containing the binary value 0000000000000000000000000000000000000000000000000000000011111111 is displayed by debuggers as 0x00000000000000FF — eight groups of two hex digits. When you read a debugger output, assembly code, or a memory dump, you are reading hex. The underlying data is binary. Octal and decimal rarely appear in low-level CPU tooling.

How are CSS colors related to hexadecimal?

A CSS hex color like #29965A is shorthand for three base-16 numbers representing the intensity of the red, green, and blue color channels. The first two hex digits (29) are the red channel: 0x29 = 41 decimal, meaning red intensity 41 out of 255. The middle two (96) are green: 0x96 = 150 decimal. The last two (5A) are blue: 0x5A = 90 decimal. This is why hex is used for colors — each channel fits in exactly one byte (0x00 to 0xFF, or 0 to 255 decimal), and two hex digits perfectly represent one byte. In CSS shorthand, #RGB (three digits) expands to #RRGGBB by doubling each digit: #F5A becomes #FF55AA.