Number Base Converter
Type in any field — decimal, binary, octal, hex or any base from 2 to 36. Fractions like 3.75, prefixes like 0xFF and negative numbers work too.
What Is a Number Base?
A number base, or radix, is the count of unique digits a positional number system uses to represent values. Decimal (base 10) is the system humans use every day, relying on the ten digits 0 through 9. Each position in a number represents a successive power of the base, so in decimal the number 255 means 2 hundreds, 5 tens, and 5 ones. Computers, however, store and process everything as on/off states, which maps naturally to binary (base 2), where the only digits are 0 and 1 and each position is a power of two.
Because long strings of binary digits are hard for people to read, programmers lean on octal (base 8) and hexadecimal (base 16) as compact shorthand. One octal digit covers exactly three binary digits, and one hexadecimal digit covers exactly four, so a single byte (eight bits) fits neatly into two hex digits. Hexadecimal uses the digits 0 through 9 plus the letters A through F to represent the values ten through fifteen. Converting between these bases changes only the representation of a number, never its underlying value.
How to Use This Number Base Converter
Type a value into any field — Decimal, Binary, Octal, Hexadecimal, or the custom field — and all other fields update instantly. The custom field converts to and from any base between 2 and 36: pick the base from the drop-down (base 3, base 12, base 32, base 36 …). Each field only accepts the digits that are valid for its base, and an invalid character is named in an error message instead of producing a wrong result.
Pasted values from code work as they are: the Hexadecimal field accepts 0xFF or #FF, the Binary field 0b1010, the Octal field 0o755, and the Decimal field recognizes all three prefixes and converts from the right base. Spaces, underscores and thousands separators such as 1111_0000, DE AD BE EF or 1,000,000 are ignored. Prefix a value with a minus sign for negative numbers, or use a point for fractions such as 3.75 or 0.1.
As soon as a valid number is recognized, the Number Details panel shows how many bits and bytes it needs, the binary form grouped into nibbles, the hex form grouped into bytes, and a table with the 8-, 16-, 32- and 64-bit two’s complement form. Use Copy next to a field to copy one result, or Copy link to this conversion to share the exact conversion.
Two’s Complement: Negative Numbers in Binary
Computers store signed integers in two’s complement. To get the bit pattern of a negative number with a fixed width, add 2width to it: -1 in 8 bits becomes 256 − 1 = 255, which is 0xFF or 1111 1111; in 32 bits it is 0xFFFFFFFF. The highest bit is the sign bit, so the same bits can be read in two ways — 0xFF is 255 as an unsigned byte (uint8) and −1 as a signed byte (int8). Enter a negative number to see its stored form, or enter a hex value such as 0xFFFFFF85 to see which signed value it represents (−123 as a 32-bit integer).
Converting Fractions Between Bases
Digits after the point are worth negative powers of the base: 0.1 in binary is one half, 0.01 one quarter. That is why 3.75 converts cleanly to 11.11 in binary, while 0.1 (one tenth) becomes 0.000110011001100… — the pattern repeats forever, because 10 contains the prime factor 5 and 2 does not. This is the same reason 0.1 + 0.2 is not exactly 0.3 in most programming languages. The converter calculates with exact fractions, shows up to 24 digits after the point and marks expansions that continue with …; the details panel tells you whether the binary and hex forms are exact.
Real-World Use Cases
- Web colors — Translate a decimal RGB component such as
255into the hex pairFFused in CSS color codes like#FF0000. - Unix file permissions — Read and build octal permission modes such as
755or644used bychmod. - Low-level debugging — Convert a memory address or register value shown in hexadecimal back into decimal to reason about it.
- Bitmask work — Check which flag bits are set by viewing a decimal configuration value in binary.
- Learning computer science — Verify homework conversions between bases and see exactly how many bits a value occupies.
Tips for Converting Number Bases
- Remember that one hexadecimal digit always equals four binary digits, which makes hex the fastest way to read raw binary by eye.
- Use the grouped binary readout in the details panel to spot individual nibbles and bytes without counting digits manually.
- Hexadecimal values are often written with a
0xprefix, binary with0band octal with0oin code; you can paste them with the prefix — even into the Decimal field. - Leading zeros do not change a value, so
0FFandFFin hex both convert to255. - This converter handles arbitrarily large integers using JavaScript BigInt, so very large values convert exactly without rounding.
Features
- Live conversion — decimal, binary, octal, hexadecimal and a custom base update together as you type in any field.
- Any base from 2 to 36 — base 3, base 5, base 12, base 32, base 36 and everything in between.
- Fractions — convert values like
3.75or0.1, calculated with exact fractions. - Arbitrary precision — built on BigInt, so large integers convert without overflow or rounding errors.
- Two’s complement — negative numbers and signed/unsigned readings for 8, 16, 32 and 64 bits.
- Paste-friendly — accepts
0x,0b,0oand#prefixes, spaces, underscores and thousands separators. - Per-base validation — invalid digits trigger a clear error message rather than a silent wrong answer.
- Copy and share — copy any field, or a link that reopens the same conversion.
- 100% client-side — your data never leaves your browser.
Frequently Asked Questions
Why is hexadecimal used so often in programming?
Hexadecimal is a compact way to represent binary data because one hex digit maps to exactly four binary digits. For example, FF in hex equals 11111111 in binary, which equals 255 in decimal. This makes hex ideal for color codes, byte values, and memory addresses.
Can this converter handle very large numbers?
Yes. The tool uses JavaScript BigInt internally, so it converts integers of arbitrary size exactly, without the rounding errors that affect ordinary floating-point numbers above about 9 quadrillion.
Does it support negative numbers?
Yes. Prefix the value with a minus sign in any field and every field shows the signed value, for example -255 in decimal becomes -FF in hexadecimal. The details panel additionally shows the two’s complement bit pattern for 8, 16, 32 and 64 bits, such as 0xFF01 for −255 in 16 bits.
How do I find the two’s complement of a number?
Enter the negative number in the Decimal field. The table under Number Details lists its two’s complement in hex and binary for every width it fits into — for example -128 is 0x80 (1000 0000) in 8 bits. By hand: write the positive value in binary, invert all bits and add 1.
Can it convert decimals or fractions?
Yes. Use a point as the separator, for example 3.75 in decimal is 11.11 in binary and 3.C in hexadecimal. Fractions that never end in the target base, such as 0.1 in binary, are shown to 24 digits and marked with ….
Which digits does base 36 use?
Bases above 10 continue with letters: base 16 uses 0–9 and A–F, base 36 uses all ten digits plus A–Z, where Z is 35. Base 36 is popular for short IDs because it is the largest base that only needs digits and case-insensitive letters.
What do the “bits needed” and “bytes needed” values mean?
Bits needed is the count of binary digits required to represent the number, and bytes needed rounds that up to whole 8-bit bytes. They show how much storage the value would occupy in memory.
Is my data sent to a server?
No. Every conversion runs entirely in your browser using client-side JavaScript, so the numbers you enter are never transmitted or stored anywhere.