🔢 Number Base Converter
Convert between binary (base 2), octal (base 8), decimal (base 10) and hexadecimal (base 16) with full precision. Works with negatives and fractions.
What is this tool?
Number base conversion is the process of expressing the same quantity in different positional numeral systems. The decimal system we use every day is base 10, meaning each digit position represents a power of ten. Computers, however, work internally in binary (base 2), where each position is a power of two. Octal (base 8) and hexadecimal (base 16) are compact shorthand notations used widely in programming, memory addressing and digital electronics because each octal digit maps to exactly three binary bits and each hex digit to four.
This converter translates any number between these four bases instantly. It handles very large integers without losing precision, supports negative values through the standard sign-magnitude convention, and even converts fractional parts with an adjustable number of digits. Just type a number, pick its base, choose the target base, and the result appears immediately.
Because everything runs locally in your browser, there is no server round-trip — conversions are instant, private and work offline. Whether you are a student learning base arithmetic, a programmer debugging hex dumps, or a network engineer reading IP addresses and MAC addresses, this tool saves you from mental arithmetic and manual long division.
For related calculations, try the scientific notation calculator, the Roman numeral converter and the data storage converter to explore more useful tools.
How it works
The calculator converts through decimal as an intermediate step. First, the input number in its source base is expanded into a polynomial and evaluated to produce the decimal value: for example, the binary number 1011₂ equals 1×2³ + 0×2² + 1×2¹ + 1×2⁰ = 8 + 0 + 2 + 1 = 11. Then the decimal value is converted to the target base using repeated division: divide the number by the target base, record the remainder, and repeat until the quotient reaches zero; the remainders read in reverse order give the result.
Fractional parts use the reverse process: multiply the fractional part by the target base, take the integer part as the next digit, and repeat. Because some fractions never terminate in certain bases (for example, 1/10 in binary is an infinite repeating expansion), the tool lets you choose how many fractional digits to compute, with a warning when the expansion does not terminate.
A useful derived feature is the bit-length estimate: for any decimal value, the tool shows how many binary bits are needed to represent it, which is helpful when allocating fixed-width fields in protocols or hardware registers.Binary Place Values
Each bit position in binary represents a power of two.
Base Conversion Reference Table
Equivalent values of 0–15 in all four supported bases.
| Decimal | Binary | Octal | Hex |
|---|---|---|---|
| 0 | 0 | 0 | 0 |
| 1 | 1 | 1 | 1 |
| 2 | 10 | 2 | 2 |
| 3 | 11 | 3 | 3 |
| 4 | 100 | 4 | 4 |
| 5 | 101 | 5 | 5 |
| 6 | 110 | 6 | 6 |
| 7 | 111 | 7 | 7 |
| 8 | 1000 | 10 | 8 |
| 9 | 1001 | 11 | 9 |
| 10 | 1010 | 12 | A |
| 11 | 1011 | 13 | B |
| 12 | 1100 | 14 | C |
| 13 | 1101 | 15 | D |
| 14 | 1110 | 16 | E |
| 15 | 1111 | 17 | F |
Common Bit Patterns Reference
Frequently used binary and hex values in computing.
| Decimal | Binary | Hex | Typical use |
|---|---|---|---|
| 255 | 11111111 | FF | Max byte value, RGB component |
| 256 | 100000000 | 100 | 1 byte overflow, 2⁸ |
| 1024 | 10000000000 | 400 | 1 KiB in binary |
| 4096 | 1000000000000 | 1000 | Page size on many systems |
| 65535 | 1111111111111111 | FFFF | Max 16-bit unsigned value |
| 2147483647 | 01111111111111111111111111111111 | 7FFFFFFF | Max 32-bit signed int |
How to use
- Enter the number you want to convert.
- Select the source base — binary, octal, decimal or hexadecimal.
- Select the target base.
- Press Convert to see the result.
- Adjust fractional digits if converting a decimal fraction.
Frequently Asked Questions
Why does the calculator convert through decimal?
Converting directly between arbitrary bases is possible but error-prone for humans. Passing through decimal as an intermediate step guarantees correctness for both integers and fractions, since decimal arithmetic is exact for the conversion process itself.
Does it support negative numbers?
Yes. Negative numbers are represented with a minus sign followed by the magnitude in the target base (sign-magnitude form). This differs from two's complement, which is a fixed-width representation used inside computer hardware.
How many digits can it handle?
The tool uses JavaScript's BigInt for integer parts, so it supports integers far beyond 2⁵³ with no loss of precision. Fractional parts are computed to a configurable number of digits.
What is two's complement and why is it not used here?
Two's complement is a way of representing negative integers in fixed-width binary (like 8-bit or 32-bit). It requires knowing the width in advance. This converter shows the simpler sign-magnitude form, which is unambiguous without a fixed width.
Why does 0.1 not convert cleanly to binary?
The decimal fraction 0.1 has an infinite repeating expansion in binary, just as 1/3 repeats in decimal (0.333...). The tool computes a limited number of digits and notes that the expansion does not terminate.
What bases are supported?
Binary (base 2), octal (base 8), decimal (base 10) and hexadecimal (base 16). These four cover the vast majority of programming, electronics and networking use cases.
Tips & Advice
Each hex digit maps to exactly four binary bits (0-F = 0000-1111), and each octal digit to three bits (0-7 = 000-111) — grouping binary digits into sets of four or three makes manual conversion much faster. Powers of two appear constantly: 2¹⁰ = 1024, which is why 1 KB equals 1024 bytes in binary notation. When converting negative numbers, remember that this tool uses a minus sign followed by the magnitude, not two's complement — two's complement is a fixed-width representation used inside computers. For fractional conversions, more target digits means more precision; binary often needs many digits to represent simple decimals like 0.1. Use hex for memory addresses and colour codes, octal for Unix file permissions, and binary when you need to reason about individual bits.
Related Tools
Scientific Notation Calculator
Convert any number to scientific notation, engineering notation and e-notation i
Roman Numeral Converter
Free online Roman numeral converter. Instantly change Arabic numbers to Roman nu
Data Storage Converter
Convert digital storage between bytes, kilobytes, megabytes, gigabytes, and tera
Percentage Calculator
Calculate percentages, changes, and ratios online for free. Find what is X perce
Fraction Calculator
Add, subtract, multiply, and divide fractions with our free fraction calculator.
Log Calculator
Calculate logarithms with any base. Compute log base 10, natural log (ln), or lo
Sources & References
- NIST. Guide to the SI - Decimal and binary prefixes. physics.nist.gov.
- Wolfram MathWorld. Number Base. mathworld.wolfram.com.
Last reviewed: August 2026.
Limitations
This tool converts between positional numeral systems. It is designed for educational and programming use.
What this tool does not account for:
- Two's complement: negative values are shown in sign-magnitude form, not the fixed-width two's complement used in computer hardware.
- Non-terminating fractions: some decimal fractions repeat forever in binary or other bases; the tool truncates after 16 fractional digits.
- Non-standard bases: bases other than 2, 8, 10 and 16 are not supported.
Always verify critical conversions with an independent method before relying on them.