Number Base Converter
Convert a number — or a whole list of them — between binary, octal, decimal, hexadecimal and any other base up to 36.
What this tool does
Number Base Converter reads each line as a number written in one base and rewrites it in another, anywhere from base 2 to base 36. Thirty-six is the ceiling because that is where the digits run out: it counts 0 to 9 and then a to z, one character per value. Arithmetic uses the browser's big-integer support rather than floating point, so a value such as 18446744073709551616 converts digit for digit instead of arriving rounded, and there is no size at which the result quietly stops being exact.
Left on Auto, the source base comes from the prefix — 0x is hexadecimal, 0b is binary, 0o is octal, a leading # is hexadecimal, and everything else is decimal. That last rule is the one to watch: 1010 on its own is read as one thousand and ten, not as ten, so set From base to Base 2 explicitly when your input carries no prefix. Underscores, spaces and commas are treated as grouping and thrown away, so a European decimal comma disappears with them and 3,14 comes back as 314; only a full stop marks the radix point, and exponent notation such as 1e3 is refused rather than expanded. Each line is converted on its own, and a digit the source base does not have halts the whole run — that character, the value and a line number are quoted back instead of the bad value being skipped and the rest converted. Blank lines are dropped before the counting, so the number you are given is the position in the list rather than the row in your editor.
Fractions are converted rather than discarded at the radix point. The part after the point is held as an exact ratio and expanded one digit at a time in the target base, which is why 0.1 in decimal comes out as 0.000110011001… in binary at the default limit of twelve digits — that expansion never terminates, so it is cut at the Fraction digits setting, which runs from one digit to sixty-four. The trailing ellipsis is there to mark a cut result as cut; a fraction that does terminate is printed without one, so you can always tell an approximation from an exact answer.
Three limits decide whether this is the right tool for the job in front of you. Negative values keep their minus sign, so it will not produce the two's complement pattern a 32-bit register holds for -1. Output has no fixed width, no leading zeros and no grouping, so 5 in binary is 101 and never 00000101. And base 64 in the Base64 sense is not on the list, because that is a byte-encoding scheme rather than a radix — Base64 Encoder Decoder covers it. The conversion itself happens in this browser tab, so nothing you paste is transmitted and the page still works with the network off.
How to use it
- Paste your numbers, one per line. Load sample fills the box with a deliberate mix: 255, 0b1101, 0o777, a fraction, a negative and a value past 64 bits.
- Set From base, or leave it on Auto. Auto reads a 0x, 0b, 0o or # prefix and treats anything else as decimal. Pick a base from 2 to 36 when the input is bare.
- Choose what to convert to. The default prints binary, octal, decimal and hex side by side as a table. Select a single base instead when one column is all you want.
- Adjust the fraction limit and the styling. Fraction digits caps a non-terminating expansion between 1 and 64 digits. Uppercase letters is on by default, and 0x / 0b / 0o prefixes are off.
Processing & privacy
Runs on your device. Your file is processed directly in this browser.
Common use cases
Reading values out of a register dump or a hex editor
Paste the 0x values as they were copied. The prefix is recognised without stripping it by hand, and the decimal and binary forms line up beside each one.
Working out a Unix permission mask
File modes are octal. Converting 755 from base 8 to base 2 shows the three-bit groups that sit behind rwxr-xr-x instead of leaving you to recall them.
Explaining why a decimal fraction misbehaves in code
Converting 0.1 to base 2 shows the repeating expansion that floating point has to cut short, which is the whole of the rounding-error story in one line.
Converting an identifier that exceeds 64 bits
A snowflake ID or a large hash is rounded by anything that parses it as an ordinary JavaScript number. Big-integer arithmetic here returns every digit.
Questions
Is anything uploaded?
Why was 1010 treated as a decimal number?
Can it show a negative number in two's complement?
What does the ellipsis after a result mean?
Why did some results come out with no prefix?
How large a number can it handle?
Does it convert text into binary?
Related tools
- Unit Converter — Convert length, weight, area, volume and speed.
- Time Zone Converter — Compare a time across several zones at once.
- Temperature Converter — Convert Celsius, Fahrenheit and Kelvin.
- Length Converter — Convert metres, feet, inches, miles and more.
- Weight Converter — Convert kilograms, pounds, ounces and stones.
- Volume Converter — Convert litres, gallons, cups and millilitres.