ToolkitBook

Base Converter: Convert Binary, Octal, Decimal, Hex Online

Convert integers between binary (base 2), octal (base 8), decimal (base 10), and hexadecimal (base 16). See all four representations at once, with conversion handled in the browser.

  • Real-time conversion between binary (2), octal (8), decimal (10), and hexadecimal (16): Results update as the input value, source base, or target base changes.
  • All Bases at a Glance grid shows all four representations at once: The same integer is displayed in binary, octal, decimal, and hexadecimal without changing settings.
  • One-click swap button reverses source and target bases: The current result becomes the new input when the conversion direction is swapped.
  • Supports negative integers and values up to 2^53 - 1 (9,007,199,254,740,991): Fractional values and base prefixes such as 0b, 0o, and 0x are not supported.
  • Browser-based conversion: Number parsing and conversion use JavaScript on the current page.
Binary
Octal
Decimal
Hexadecimal

How to Use This Base Converter

  1. Enter your number: Type any integer in the "Value" field. Valid characters depend on the selected source base: 0–1 for binary, 0–7 for octal, 0–9 for decimal, and 0–9 plus A–F for hexadecimal. Do not include prefixes like 0b, 0o, or 0x.
  2. Select source and target bases: Choose from the "From Base" and "To Base" dropdowns. The converted result updates as you type. Use the swap button (⇄) to reverse the direction and continue converting.
  3. View all representations at once: The "All Bases at a Glance" grid below the converter shows your number in binary, octal, decimal, and hexadecimal at the same time, without switching settings.
  4. Fix invalid input: If you enter an invalid character for the selected base, such as "2" in binary mode, the tool shows an error. Correct the input and the result refreshes automatically.

Practical Applications

Debugging color codes: Convert CSS hex color values to decimal RGB components. For example, enter FF in hexadecimal mode to get 255 — the maximum value for a single color channel in CSS. Use this when writing JavaScript that manipulates canvas pixels or when matching colors between design tools and code.

Working with file permissions: Unix file permissions are commonly shown in octal (e.g. 755). Enter 755 in octal mode to see it as binary 111101101, where each triplet shows the read/write/execute bits for owner, group, and others. Common values: 777 (full access), 644 (read-only for group/others), 700 (owner only).

Reading memory addresses: Memory addresses and debug logs frequently use hexadecimal notation. Convert hex values like 7FFF to decimal (32,767) or binary to inspect the numeric range or bit layout during low-level debugging.

Learning number systems: Computer science students can enter any decimal number and see its binary, octal, and hexadecimal equivalents. Start with small values like 10, 42, or 255 to build intuition, then work up to larger numbers. The All Bases grid makes it easy to compare representations side by side.

Parsing network addresses: MAC addresses (00:1A:2B:3C:4D:5E) and IPv6 addresses use hexadecimal notation. Each hex pair in a MAC address represents one byte — convert 1A to decimal 26 or binary 00011010 to understand the device identifier structure.

FAQ

Q. How do I convert binary to decimal?

Enter your binary number (using only 0s and 1s), select "Binary (2)" as the From Base and "Decimal (10)" as the To Base. The result appears as you type. You can also see the decimal value in the "All Bases at a Glance" grid without changing any settings.

Q. What number bases does this converter support?

This tool supports four number systems: binary (base 2, digits 0–1), octal (base 8, digits 0–7), decimal (base 10, digits 0–9), and hexadecimal (base 16, digits 0–9 and A–F). Each representation appears in the "All Bases at a Glance" grid.

Q. Can I convert negative numbers between bases?

Yes. Type a minus sign before your number and the converter will display the signed result across all four bases. For example, entering -255 in decimal shows -11111111 in binary, -377 in octal, and -FF in hexadecimal.

Q. How do I convert a hex color code to decimal RGB values?

Remove the # prefix and convert each two-character pair separately. For #FF6600, convert FF to decimal (255) for the red channel, 66 to decimal (102) for green, and 00 to decimal (0) for blue. This tool handles one value at a time, so enter each pair individually.

Q. What is the largest number this base converter can handle?

The maximum supported value is 2^53 - 1 (9,007,199,254,740,991 in decimal). Numbers beyond this limit may lose precision because JavaScript uses 64-bit floating-point representation for all numbers.

About the Base Converter

Convert integers between binary (base 2), octal (base 8), decimal (base 10), and hexadecimal (base 16). Enter a value in one number system and see the equivalent value in the other three in the All Bases at a Glance grid. Results update as you type.

The converter supports negative integers and handles values up to 2^53 - 1 (9,007,199,254,740,991 in decimal). A one-click swap button reverses the source and target bases and uses the current result as the next input. Calculations use JavaScript number conversion on the current page.

Use it for debugging hex color codes, parsing Unix file permissions, learning number systems, or reading MAC and IPv6 addresses.

Supported Formats

Base Name Valid Characters Common Use
2Binary0, 1Digital logic, bit flags
8Octal0–7Unix file permissions
10Decimal0–9Everyday arithmetic
16Hexadecimal0–9, A–FColor codes, memory addresses

When to Use This Base Converter

Common Number Conversions Reference

Decimal Binary Octal Hex Description
21022Binary base unit
81000108Octal base unit
10101012ADecimal base
16100002010Hexadecimal base unit
3210000040205-bit maximum + 1
641000000100406-bit maximum + 1
12810000000200807-bit maximum + 1
25511111111377FF8-bit maximum (1 byte)
2561000000004001002^8
10241000000000020004001 KB
655351111111111111111177777FFFF16-bit maximum
4931111011017551EDUnix permission: rwxr-xr-x

Tips for Using This Base Converter

Related Developer Tools