Number Base Converter (Binary, Octal, Decimal, Hexadecimal)

Convert numbers between binary, octal, decimal, and hexadecimal. Uses BigInt so even very large integers are converted with no loss of precision.

What Is a Number Base Converter? Understanding Binary, Octal, Decimal, and Hexadecimal

A number base converter lets you enter a value in binary, octal, decimal, or hexadecimal and instantly see the equivalent value in the other three bases. Programming, networking, and electronics work all frequently require moving the same value between bases, and manual conversion becomes error-prone as the number of digits grows. This tool validates your input and displays every conversion immediately, so you never need a separate calculator app or a printed conversion table.

The mechanics of base conversion are simple: every base represents the same quantity as a sum of "digit value times place weight." The decimal number 255 is written as 11111111 in binary, 377 in octal, and FF in hexadecimal — the notation changes, but the quantity being described never does. This tool performs its calculations with BigInt (an arbitrary-precision integer type) rather than JavaScript's ordinary Number type, so even very large integers beyond 2^53 convert with complete accuracy and no rounding error.

How to Use the Number Base Converter

  1. Choose the base of your input value Select whether the number you are about to enter is written in binary, octal, decimal, or hexadecimal.
  2. Enter the value Type only the characters valid for the base you selected. Hexadecimal also accepts the letters A through F.
  3. Check for invalid characters If the value contains a character that is not valid for the selected base, an error message appears so you can correct the input.
  4. Review the converted results No button press is needed — the binary, octal, decimal, and hexadecimal representations are all displayed automatically.
  5. Convert additional values Changing the value or the selected base recalculates the results instantly, so you can check several numbers one after another.

Tips for getting more out of it

  • When entering a hexadecimal value, omit prefixes like `0x` and enter only the digits (e.g. `FF`). Both uppercase and lowercase letters are recognized.
  • This tool uses BigInt internally, so it can accurately convert very large integers (beyond 2^53) that would lose precision with JavaScript's Number type.
  • Handy for everyday programming tasks, such as reading hex color codes (e.g. `#FF0000`) or checking binary representations when verifying bitwise operations.
  • Octal is commonly used for Unix-style file permissions (e.g. `755`). Comparing it side by side with decimal and binary makes the meaning of each permission easier to understand.

Ways to Use the Number Base Converter

Checking programming coursework and exam answers

After working through a base-conversion exercise from a computer science class or certification exam, quickly verify whether your manual calculation was correct.

Inspecting bitmasks and color codes

Convert a hexadecimal color code (such as `#FF0000`) or a bitwise flag value into binary to see exactly which bits are set.

Preparing for network address and subnet calculations

Convert an IP address or subnet mask into binary as a first step toward identifying the boundary between the network portion and the host portion.

Understanding Unix file permissions

Convert an octal permission value like `chmod 755` into binary to see visually how the read, write, and execute permissions combine for each user class.

Debugging systems that handle large integers

When a log file or memory dump shows a large value such as a 64-bit integer in hexadecimal, convert it to decimal with no rounding error to get an intuitive sense of its magnitude.

Number Base Glossary

Binary
A number system that represents values using only the digits 0 and 1. Inside a computer, these two states typically correspond to high and low voltage, or a switch being on or off.
Octal
A number system that uses the eight digits 0 through 7. Because three binary digits map exactly onto one octal digit, it was common on early computers and is still used for Unix-style file permissions.
Decimal
The number system we use in everyday life, built from the ten digits 0 through 9. This tool accepts decimal both as an input base and as one of the converted outputs.
Hexadecimal
A number system that uses sixteen symbols, 0 through 9 and A through F. Because four binary digits map exactly onto one hexadecimal digit, it is widely used to represent memory addresses, color codes, and other internal computer values in a compact, human-readable form.
Radix (Base)
The number of distinct digits a number system uses for a single place. Binary has a radix of 2, octal 8, decimal 10, and hexadecimal 16.
BigInt
A JavaScript data type that represents integers with no limit on the number of digits. Ordinary Number values lose precision beyond 2^53, but BigInt converts numbers of any size with complete accuracy.
Place value (digit weight)
The contribution a digit makes to the overall value based on its position. In decimal, the hundreds place carries a weight of 100; base conversion works by multiplying each digit by its place weight and summing the results.
Bitmask
A binary pattern used to isolate or modify specific bit positions within a value. Converting a hexadecimal value or color code into binary makes it much easier to see which individual bits are set.

Frequently Asked Questions

These are all different "bases" (radixes) used to represent numbers. Decimal uses 10 digits (0-9) and is the familiar system we use every day; binary uses only 0 and 1 and is what computers use internally; octal uses 0-7; and hexadecimal uses 0-9 and A-F. Octal and hexadecimal are both widely used in computer science and electronics.

A single hexadecimal digit represents exactly 4 bits (4 binary digits), making it a convenient way to compress binary data into a form that's much easier for humans to read. It's widely used for memory addresses, color codes (`#RRGGBB`), character codes, and other places where raw bit patterns need to be handled.

Conversions done with an ordinary calculator or JavaScript's Number type can lose precision for integers larger than 2^53 (roughly 9 quadrillion). This tool uses BigInt, an arbitrary-precision integer type, so it converts numbers of any size accurately, with no error.

Octal is mainly used for Unix-style (Linux, macOS, etc.) file permission notation, such as `chmod 755`. Each digit represents a combination of read (4), write (2), and execute (1) permissions, so a single octal digit can concisely express the permissions for the owner, group, and other users.
Tool-kun

Side Note — Why Do Computers Run on Binary?

Computers are built on binary (0 and 1) because electronic circuits can reliably distinguish between just two states — "high voltage / low voltage" or "switch on / switch off." Building a circuit that must precisely distinguish ten different voltage levels, as decimal would require, is far more sensitive to noise and more complex than one that only needs to tell two states apart. For these practical engineering reasons, nearly every modern computer is built on binary.

Hexadecimal is so useful in programming because of a neat mathematical fact: exactly four binary digits (0000 through 1111) map onto exactly one hexadecimal digit (0 through F). A single byte (8 bits), for example, can be written as just two hexadecimal digits (`00` through `FF`), compressing what would otherwise be eight binary digits into a much more readable length.

Octal became popular for historical reasons: early computers such as the PDP-8 (1960s) used word sizes that were multiples of 3 bits — 12 bits or 36 bits, for instance — which made octal a natural fit at the time. Once computers standardized on word sizes that are multiples of 4 bits — 8, 16, or 32 bits — hexadecimal became the more practical choice, and it remains dominant today. Even so, octal still survives in certain niches, such as Unix file permissions.