araç köşesi

Number Base Converter

Convert between base 2, 8, 10 and 16 without losing a digit

Your data stays with you. Conversion happens inside the browser; nothing is sent to a server.

How it works

Write one number per line and the output keeps the same order. With the input base on automatic the prefix decides: a line starting 0x is read as hexadecimal, 0b as binary, 0o as octal. Without a prefix, a line containing the letters a to f is taken as hexadecimal. A prefix-free line made only of 0s and 1s fits both binary and decimal — decimal is assumed, and the note under the output tells you how many lines were ambiguous. If that uncertainty bothers you, select the input base from the list and no prefix is looked for. Spaces and underscores inside a number are ignored, so 1010_1010 and FF FF are read as written. With the output base on all four, each value is printed with its own prefix and hexadecimal in capitals, so you never have to count digits to work out which base you are looking at. Conversion is done with whole numbers only: negative values and decimals are not supported and those lines are marked rather than converted.

This tool is also known as binary to decimal, decimal to binary, hex to decimal, number base converter, binary to hex, 0xff in decimal, octal to decimal, hex to octal.

What is Binary (base 2)?

Binary writes numbers using only the digits 0 and 1. Each position, read from the right, stands for a rising power of two, so 1011 means 8 + 0 + 2 + 1, which is eleven. Hardware is the reason it underlies computing: in a circuit current is either flowing or it is not, with no state in between, so two digits is all the electronics can distinguish. Length is binary's great drawback — an ordinary number sprawls across many digits — which is why the same data is usually shown to people in hexadecimal instead.

What is Hexadecimal (base 16)?

Hexadecimal is base 16: after the digits 0 to 9 it uses the letters A, B, C, D, E and F for the values ten to fifteen. Its popularity comes from a tidy relationship with binary — each hexadecimal character corresponds to exactly four binary digits, so converting between the two is substitution rather than calculation. That is why colour codes, memory addresses, hash values and byte dumps are all written in hexadecimal: it is compact for a person to read while still lining up cleanly with the underlying bits.

Where is octal still used?

Octal (base 8) turns up in far fewer places than hexadecimal, but it has not disappeared. Its best-known use is Unix and Linux file permissions: in a three-digit code such as 755 or 644, each digit carries the read, write and execute rights as three binary positions, which is exactly what one octal digit holds — the notation fits the problem perfectly. The 0o prefix in programming languages comes from the same tradition, as does the older habit of marking octal with a leading zero. Hexadecimal works in groups of four bits, which lines up with a byte, and that is why it dominates wherever data is measured in bytes.

Why long numbers do not get mangled here

A browser's ordinary number type cannot hold whole numbers above 2 to the power of 53 (9,007,199,254,740,992) exactly; past that limit the trailing digits are quietly rounded. That is why a 64-bit ID or a long hexadecimal stamp comes back with the wrong last few digits from a typical converter, with no warning that anything went wrong.

This tool builds each value digit by digit using exact whole-number arithmetic, so results above that limit are still correct. The 9007199254740993 line in the example is there to show it: the final digit survives the round trip. How many digits you paste makes no difference.

What the prefixes mean

The same run of digits means different numbers in different bases: 101 is five in binary and one hundred and one in decimal. Programming languages mark the base with a prefix precisely to stop that confusion.

The output uses those same prefixes, because copying a value with no base marked and pasting it somewhere else is the quietest source of error there is. Decimal is the exception and is printed bare, which is how everyone already reads it.

  • 0b → binary, digits 0 and 1 only
  • 0o → octal, digits 0 to 7
  • 0x → hexadecimal, digits 0-9 and letters A-F
  • no prefix → decimal, everyday notation

Frequently asked questions

How do I convert binary to decimal?

Write the number with the 0b prefix, as in 0b1011, or set the input base to 2. The decimal value appears on the same line, so a whole column of values can be converted in one pass.

Can I convert hex to decimal?

Yes. Write it with the prefix as 0xFF or plainly as FF; the letters mark it out as hexadecimal and the decimal value is printed beside it.

Are very large numbers accurate?

Yes. The conversion uses exact whole-number arithmetic, so values above the 2 to the power of 53 limit keep their trailing digits instead of being rounded off.

Can I convert negative or decimal numbers?

No. This tool handles positive whole numbers only. A line with a minus sign, a decimal point or a comma is marked in the output rather than converted, so you can see it was skipped.

What do the 0x and 0b prefixes mean, and can I paste 0xFF directly?

0x marks a hexadecimal number and 0b a binary one (0o is octal); programming languages and documentation use these prefixes so the base is never in doubt. You can paste them as they are: with the input base left on Automatic, the tool reads the prefix and converts the rest, so 0xFF gives 255 and 0b1011 gives 11. If you pick a fixed input base instead, a matching prefix is simply dropped before converting. Hex results are shown with the 0x prefix as well, and binary results with 0b.