calculate.sh DE

This tool runs in your browser using JavaScript. If it does not appear, please enable JavaScript or reload the page. The description below explains how it works.

Number Base Converter

Computers store numbers as binary - zeros and ones - but people usually work in decimal, and developers constantly jump between binary, octal, decimal, and hexadecimal. This tool converts the same integer into all four bases at once. Type into any field and the other three update immediately, so you never have to think about which one is the "source".

How to use

  1. Type into any of the four fields. The tool treats the field you are editing as the source and updates the other three. The active field is highlighted blue so you can always see which representation you started from.
  2. Keep typing - conversion happens with every keystroke, there is no button to press.
  3. Uppercase hex - toggles whether letters A–F in the hexadecimal field are shown in capitals (FF instead of ff). Applied automatically to the hex column whenever the tool rewrites it; digits typed by you are always accepted in either case.
  4. Copy - each row has its own copy button, so you can grab exactly the representation you need (for example only the binary form) without touching the others.
  5. Clear - resets all four fields and puts the cursor back on the decimal row.

What it does

The same integer is written in four notations:

  • Binary (base 2) - digits 0 and 1. The natural form inside a CPU, used for bit masks, IPv4 addresses for network engineers, and flag bitfields such as Unix file permissions before they are packed.
  • Octal (base 8) - digits 0 to 7. Classic Unix file permissions (755, 644) and some legacy encodings read in octal. Rare today, but still worth having at hand.
  • Decimal (base 10) - digits 0 to 9. The natural human notation and the one used for most everyday numbers.
  • Hexadecimal (base 16) - digits 0 to 9 plus A to F. The compact way to write bytes: two hex digits are exactly one byte. Used for colors (#0f0f0f), memory addresses, hash digests, and binary inspection tools such as hexdump.

Notes and examples

  • 255 in decimal is 11111111 in binary, 377 in octal, and ff in hexadecimal. Try typing 255, then 11111111, then ff - you end at the same number each time.
  • 128 in decimal is 10000000 in binary (a single bit set - handy when reasoning about powers of two) and 80 in hexadecimal.
  • Negative numbers work: -8 in decimal is -1000 in binary, -10 in octal, and -8 in hexadecimal. The minus sign is kept outside each representation.
  • The converter is built on JavaScript BigInt, so it handles values far beyond the 53-bit safe-integer range of ordinary parseInt-based converters without silently rounding. A 30-digit decimal number converts exactly.
  • Only whole numbers are supported. Fractions like 3.14 or 1/3 are not accepted; feed in the integer part only. If you need fractional binary/hex work, that belongs in a different tool than this site currently offers.
  • No prefixes. Type raw digits only - 0x, 0b, trailing h, or # are not recognized. Paste the digits and leave the prefix behind (the tool would otherwise reject the x, b, or # characters with a clear per-character error).
  • Leading zeros are not preserved. When you type 001 in decimal, the other fields show 1. The field you are typing into keeps exactly what you typed; the others show the canonical, shortest form.
  • Invalid digits produce a specific error that names the offending character and the allowed range, for example "9" is not a valid Binary digit (0–1). Inputs longer than 4,096 digits are rejected to keep the page responsive.

When to use this over other tools on the site

If you mostly move between text encodings, the Base64 tool is about converting text, not numbers. This converter is deliberately numeric. If you are translating a whole set of numbers at once rather than one value, work through them one at a time - there is no batch mode.