Math

Base Converter

Convert numbers instantly between binary, octal, decimal, and hexadecimal with a live place-value breakdown.

Did this calculator help you?

What is Base Converter?

A base converter translates a number from one positional numeral system into another — most commonly between binary (base 2), octal (base 8), decimal (base 10), and hexadecimal (base 16). Every number system works the same way: each digit's value depends on its position, multiplied by the base raised to that position's power. Computers store and process everything in binary, but binary strings get long and hard to read, so programmers use hexadecimal as a compact shorthand, and octal shows up in older Unix file permissions. This calculator instantly converts your input across all four bases at once, and shows the place-value breakdown — each digit times its positional weight — so you can see exactly how the conversion works rather than just getting an opaque answer.

When to Use This Calculator

  • Debugging memory addresses and byte values in software development, where hex output is the convention.
  • Converting hex color codes to RGB values for web design and CSS styling.
  • Understanding IP subnet masks and network addressing, which are written in dotted binary or hex.
  • Reading Unix/Linux file permission codes like chmod 755, which use octal notation.
  • Computer science coursework and exams covering number systems and data representation.
  • Competitive programming and low-level coding where bitwise operations are expressed in binary or hex.

Steps:

  1. Type the number you want to convert.
  2. Select which base that number is currently written in (binary, octal, decimal, or hex).
  3. Read the converted value in all four bases instantly.
  4. Expand the place-value breakdown to see how each digit contributes to the total.

Formula

Value = Σ (digit × base^position) Position counts from 0 at the rightmost digit. Example (binary 1011): 1×2³ + 0×2² + 1×2¹ + 1×2⁰ = 11 (decimal)

Use Cases

  • Debugging memory addresses and byte values in software development
  • Converting color codes between hex and decimal for web design
  • Working with binary and hex in computer science coursework
  • Reading Unix/Linux file permission codes written in octal
  • Understanding IP subnet masks and network addressing

Key Benefits

  • Instant conversion across binary, octal, decimal, and hex simultaneously
  • Visual place-value breakdown shows exactly how the math works
  • Catches invalid digits for the selected base immediately
  • No manual long division or repeated remainder calculations needed

Pro Tips

  • When reading hex, remember each digit is worth exactly 4 bits — useful for mental binary conversion
  • Group binary digits in fours from the right to convert to hex quickly by hand
  • Octal digits group binary in threes, which is why it was common on older 12/24-bit systems
  • Double-check the selected 'from' base matches what you actually typed before trusting the result

Common Mistakes to Avoid

  • Entering digits invalid for the selected base, like '9' in binary or octal
  • Forgetting that hexadecimal digits A-F are case-insensitive but represent fixed values
  • Confusing octal's leading-zero notation with decimal numbers in older programming languages
  • Assuming binary conversions handle negative numbers without a two's-complement scheme

Key Terms Explained

Radix: Another name for the base of a number system
Positional notation: A system where a digit's value depends on its position
Bit: A single binary digit (0 or 1)
Nibble: A group of 4 bits, exactly one hexadecimal digit

Related Concepts

  • Color values: A hex color like #FF5733 is three base-16 bytes. Our color converter moves between hex, RGB, HSL, and named color formats.
  • Binary and data sizes: Byte values in hex map directly onto data quantities. Our data converter converts between bits, bytes, and storage units.
  • Epoch timestamps: Unix time is often shown in decimal and hex. Our unix timestamp converter translates timestamps to and from human-readable dates.
  • Hashes: Cryptographic digests such as MD5 and SHA-256 are strings of hex digits. Our hash generator produces these common hash formats.
  • Encoding: Percent-encoding in URLs writes each special character as a hex escape like %2F. Our url encoder-decoder encodes and decodes URL content.

Example

Converting hexadecimal 2F to decimal: 2×16¹ + 15×16⁰ = 32 + 15 = 47. In binary, 47 is 101111, and in octal it's 57.

Interpreting Your Results

The converter shows every result as a number string in the base you select, and the place-value breakdown expands each digit into digit × base^position so you can verify the math by hand instead of trusting a black box. The rightmost digit is position 0 and its weight is always 1; moving left, each weight is multiplied by the base once more (so in binary the weights are 1, 2, 4, 8… and in hex 1, 16, 256…). Adding up every digit × weight reproduces the decimal value exactly. Input must use only digits valid for the selected base — the tool flags any invalid digit immediately. Note that the tool handles non-negative whole numbers only; negative and fractional values need two's-complement or floating-point treatment that a positional integer converter does not cover.

Frequently Asked Questions

How do I convert binary to decimal?
Multiply each binary digit by 2 raised to its position power (starting from 0 on the right) and add the results. For example, 1011 in binary = 1×2³ + 0×2² + 1×2¹ + 1×2⁰ = 8 + 0 + 2 + 1 = 11 in decimal.
Why is hexadecimal used in computing?
Hexadecimal (base 16) maps cleanly onto binary because each hex digit represents exactly 4 bits, making it a compact, human-readable way to write memory addresses, color codes, and byte values without the length of pure binary.
What digits are valid in each base?
Binary uses 0-1, octal uses 0-7, decimal uses 0-9, and hexadecimal uses 0-9 plus A-F (representing 10-15). Entering a digit outside that range for the selected base will show an error.
Can I convert negative numbers or decimals with fractional parts?
This tool converts non-negative whole numbers, which covers the vast majority of programming, networking, and coursework use cases. For signed or fractional binary representations, specialized two's-complement or floating-point tools are needed.
How do I convert a hex color code (like #FF5733) to RGB?
A hex color code is simply three two-digit hexadecimal numbers packed together: red, green, and blue. Split #FF5733 into FF, 57, and 33, then convert each pair to decimal: FF = 255, 57 = 87, and 33 = 51, giving rgb(255, 87, 51). Each pair ranges from 00 (0) to FF (255), so every one of the 16,777,216 possible colors can be written as six hex digits. This is why CSS uses hex so heavily — it is compact, and each pair maps directly onto the byte the browser stores for that channel.
What is two's complement and how does it represent negative binary numbers?
Two's complement is the standard way computers store negative integers. To negate a number, invert every bit and add 1: for +5 in 8 bits (00000101), flip the bits (11111010) and add 1 to get 11111011, which represents −5. The leftmost bit acts as a sign indicator — 0 means non-negative, 1 means negative — while keeping addition circuitry identical for both signs. A 4-bit two's-complement value spans −8 to +7 rather than 0 to 15, because half the range is consumed by negatives. This tool converts non-negative whole numbers; for signed values you apply two's complement yourself on top of the binary output.
Why does my converter show extra leading zeros in binary?
Leading zeros never change a number's value — 0011 and 11 are both decimal 3 — but they are often shown deliberately. Programmers group binary into nibbles (4 bits) or bytes (8 bits) so the pattern aligns with hexadecimal: 0011 0011 reads as 33 in hex, while the ungrouped 110011 is harder to parse. Some tools pad to fixed widths (8, 16, or 32 bits) to mirror the actual registers in a computer. If you prefer the shortest form, simply drop the leading zeros from the output — the value remains identical.
How is octal used in Unix file permissions (chmod)?
Unix permissions are three triples — read (r), write (w), and execute (x) — for the owner, group, and others. Each triple is a 3-bit binary number, so it maps onto a single octal digit: rwx = 7, rw- = 6, r-x = 5, r-- = 4. The command chmod 755 therefore sets owner rwx, group r-x, and others r-x — exactly why 7, 5, 5 appear as three octal digits. Octal is the natural notation here because every digit covers exactly three bits, matching the three permission positions per party.
Can this tool convert very large numbers without losing precision?
This converter is accurate for every whole number up to 2^53 − 1 = 9,007,199,254,740,991, the largest integer JavaScript can represent exactly. Values beyond that boundary can round to the nearest representable number, so the output may drift from the exact conversion. For everyday work — color codes, memory addresses, IP masks, port numbers, and coursework numbers — that range is far more than sufficient. If you need conversions beyond 53 bits, you would need an arbitrary-precision tool rather than a standard in-browser converter.
How do I convert a decimal number to binary by hand?
Divide the number repeatedly by 2, recording the remainder at each step, then read the remainders from bottom to top. For 47: 47 ÷ 2 = 23 r 1, 23 ÷ 2 = 11 r 1, 11 ÷ 2 = 5 r 1, 5 ÷ 2 = 2 r 1, 2 ÷ 2 = 1 r 0, 1 ÷ 2 = 0 r 1. Reading the remainders upward gives 101111, which equals 32 + 8 + 4 + 2 + 1 = 47. The same repeated-division method works for any base — divide by 8 for octal, by 16 for hex — collecting the remainders in reverse order.
How do I convert between binary and hex directly, without going through decimal?
Because one hex digit equals exactly four bits, you can convert without any decimal step. Group the binary digits in fours from the right and translate each group to its hex digit: 101111 → 0010 1111 → 2F. Each 4-bit group maps to one hex symbol (0000=0 up to 1111=F). Going the other way, expand each hex digit into its four bits: 2F → 0010 1111. The same shortcut works for octal, which pairs with binary in groups of three bits — which is why binary, octal, and hex interconvert so effortlessly.

Discover More Tools

Fresh picks from across our tool library.