Number Base Converter

Convert between binary, hex, decimal

Convert numbers between binary (2), octal (8), decimal (10), and hexadecimal (16) bases.

What is Number Base Converter?

Number bases are different systems for representing numeric values using distinct sets of digits. The decimal system (base 10) uses digits 0 through 9 and is the everyday numbering system most people use. Binary (base 2) uses only 0 and 1, forming the fundamental language of all digital computers — every piece of data in memory is ultimately stored as binary bits. Octal (base 8) uses digits 0 through 7 and was historically important in early computing systems like the PDP-8 and PDP-11; it still appears in Unix file permissions (e.g., chmod 755). Hexadecimal (base 16) extends decimal with letters A through F, providing a compact human-readable representation of binary data — one hex digit maps to exactly four binary digits. Programmers encounter hex constantly in color codes (#FF5733), memory addresses (0x7FFF0A1B), MAC addresses, and byte-level debugging. This converter handles all four common bases simultaneously, letting you enter a number in any supported base and instantly see its representation in every other base. Whether you are debugging a bitwise operation, converting a CSS color value, reading a memory dump, or working through a computer science assignment, this tool eliminates manual calculation errors and saves time.

How to Use

  1. Type the number you want to convert into the input field
  2. Select the base of your input number using the dropdown — Binary (2), Octal (8), Decimal (10), or Hexadecimal (16)
  3. Click "Convert" to see the number expressed in all four bases at once
  4. Click the copy icon next to any result to copy that value to your clipboard
  5. Use "Load Sample" to try the converter with the value 255, which demonstrates interesting conversions across all bases

Why Use This Tool?

Instantly converts a number into all four common bases — binary, octal, decimal, and hexadecimal — in a single operation
Eliminates manual conversion errors that are common when working with unfamiliar bases
Copy individual results with one click for pasting into code, documentation, or configuration files
Handles large integers correctly using JavaScript's native BigInt-safe parseInt, avoiding floating-point rounding issues
Clear error messages guide you when input characters are invalid for the selected base

Tips & Best Practices

  • In code, prefix binary with 0b (0b1010 = 10), octal with 0o (0o755 = 493), and hex with 0x (0xFF = 255)
  • CSS color codes are hexadecimal — #FF5733 means red=255, green=87, blue=51 in decimal
  • Each hex digit maps to exactly 4 binary digits, making hex-to-binary conversion trivial: F = 1111, A = 1010
  • Unix file permissions use octal: chmod 755 means owner=read+write+execute (7), group=read+execute (5), others=read+execute (5)
  • When debugging memory addresses or byte values, convert to hex for a more compact and readable representation

Frequently Asked Questions

What are number bases and how do they differ?

A number base (or radix) defines how many unique digits are used to represent values. Base 10 (decimal) uses 0-9. Base 2 (binary) uses 0-1. Base 8 (octal) uses 0-7. Base 16 (hexadecimal) uses 0-9 plus A-F. The same numeric value has different representations in each base — for example, decimal 255 is binary 11111111, octal 377, and hexadecimal FF.

Why is hexadecimal so popular in programming?

Hexadecimal provides a compact, human-readable representation of binary data. One hex digit represents exactly 4 binary digits (a nibble), and two hex digits represent one byte. This makes hex ideal for color codes, memory addresses, MAC addresses, and any context where you need to read or communicate binary values without writing long strings of 0s and 1s.

When should I NOT use this converter?

This tool handles positive integers only. Do not use it for floating-point numbers, negative numbers in two's complement representation, or fractional base conversions. For signed integer bit representations and IEEE 754 floating-point analysis, use a dedicated binary inspector or debugger instead.

Is octal still relevant in modern programming?

Octal is less common today but still appears in specific contexts: Unix and Linux file permissions (chmod 755), some legacy system configurations, and JavaScript/Python octal literals (0o prefix). Each octal digit maps to 3 binary digits, which was convenient for 12-bit and 36-bit word machines of the past.

How do I manually convert between bases?

For decimal to binary: repeatedly divide by 2 and record remainders bottom-up. For binary to hex: group binary digits in sets of 4 (right to left) and convert each group to its hex equivalent. For decimal to hex: repeatedly divide by 16 and map remainders 10-15 to A-F. This tool automates all of these calculations instantly.

Is my input data sent to a server?

No. All conversion logic runs entirely in your browser using JavaScript. No numbers or calculations are transmitted to any server, so you can safely convert sensitive values like encryption keys or memory addresses.

Real-world Examples

CSS Color Code Conversion

Convert a hex color code to its decimal RGB components for use in a programmatic color calculation.

Input
FF5733
Output
Binary: 111111110101011100110011
Octal: 37653463
Decimal: 16734259
Hexadecimal: FF5733

Unix File Permission Octal to Binary

Understand what each bit in a Unix permission octal value represents by converting to binary.

Input
755
Output
Binary: 111101101
Octal: 755
Decimal: 493
Hexadecimal: 1ED

Related Tools