Number Base Converter

Convert between Binary, Octal, Decimal, and Hexadecimal

Instant conversion between different number systems. Perfect for programmers, students, and anyone working with computer science.

Binary (Base 2)

Uses digits: 0, 1

Example: 11111111 = 255 in decimal

Octal (Base 8)

Uses digits: 0-7

Example: 377 = 255 in decimal

Decimal (Base 10)

Uses digits: 0-9

Example: 255 (standard number system)

Hexadecimal (Base 16)

Uses: 0-9, A-F

Example: FF = 255 in decimal

Quick Reference Table

DecimalBinaryOctalHexadecimal
0000
1111
21022
31133
410044
510155
611066
711177
81000108
91001119
10101012A
15111117F
16100002010
3111111371F
321000004020
63111111773F
64100000010040
12711111111777F
1281000000020080
25511111111377FF

Number Systems Explained

Binary (Base 2)

Fundamental to all digital electronics. Each digit represents a power of 2. Used in computer memory, processors, and digital logic.

Octal (Base 8)

Historical importance in computing. Each octal digit represents 3 binary digits. Still used in Unix file permissions.

Decimal (Base 10)

The standard number system we use daily. Based on powers of 10. Most intuitive for human understanding.

Hexadecimal (Base 16)

Compact representation of binary. Each hex digit = 4 binary digits. Widely used for colors, memory addresses, and debugging.

Common Use Cases

  • ๐Ÿ”ข Programming: Convert between bases for bitwise operations and debugging
  • ๐ŸŽจ Web Design: Convert hex color codes to RGB decimal values
  • ๐Ÿ’พ Memory Addresses: Read hexadecimal memory addresses in decimal
  • ๐Ÿ” File Permissions: Understand Unix octal permission values
  • ๐ŸŽ“ Learning: Computer science education and understanding low-level programming
  • โš™๏ธ Hardware: Configure embedded systems and microcontrollers

How It Works

A number base (or radix) defines how many unique digits a positional numeral system uses. Decimal (base 10) uses digits 0-9, binary (base 2) uses 0-1, octal (base 8) uses 0-7, and hexadecimal (base 16) uses 0-9 plus A-F. This converter transforms numbers between any of these systems and supports custom bases from 2 to 36.



The conversion process works in two steps. First, the input number is parsed from its source base into an intermediate representation. Each digit is multiplied by the base raised to the power of its position (counting from right, starting at 0), and the products are summed. For example, binary 1011 becomes: (1ร—2ยณ) + (0ร—2ยฒ) + (1ร—2ยน) + (1ร—2โฐ) = 8 + 0 + 2 + 1 = 11 in decimal.



Second, the intermediate value is converted to the target base through repeated division. The number is divided by the target base, and the remainder becomes the rightmost digit. The quotient is divided again, producing the next digit, and this continues until the quotient reaches zero. The remainders, read in reverse order, form the result. For bases above 10, remainders 10-35 are represented by letters A-Z.



The tool handles these conversions using JavaScript's built-in parseInt() for parsing and toString() for output, with validation to ensure digits are valid for the specified base.

Use Cases

1. Programming & Computer Science
Developers constantly convert between binary, hex, and decimal when working with bitwise operations, memory addresses, color codes, file headers, and low-level system programming. Understanding the relationship between 0xFF, 255, and 11111111 is essential for debugging and writing correct bit manipulation code.



2. Digital Electronics & Hardware Design
Electrical engineers designing digital circuits, FPGA configurations, and microcontroller firmware work primarily in binary and hexadecimal. Converting between bases helps translate between schematic-level binary signals and human-readable hex notation used in datasheets and documentation.



3. Networking & IP Addressing
Network engineers convert between binary and decimal to calculate subnet masks, IP ranges, and CIDR notation. Understanding that a /24 subnet mask is 11111111.11111111.11111111.00000000 in binary and 255.255.255.0 in decimal is fundamental to network configuration and troubleshooting.



4. Computer Science Education
Students learning number systems, data representation, and computer architecture use base converters to check their manual conversion work and build intuition about how computers store and process numbers. Seeing the same value in multiple bases simultaneously reinforces understanding.



5. Cryptography & Security
Cryptographic work frequently involves hex-encoded values โ€” hash digests, encryption keys, and initialization vectors are typically displayed in hexadecimal. Converting between hex and binary helps analysts understand the actual bit patterns underlying cryptographic operations and verify implementations.

Tips & Best Practices

โ€ข Learn the hex-to-binary shortcut: Each hex digit maps exactly to 4 binary digits. Memorize: 0=0000, 1=0001, ..., 9=1001, A=1010, B=1011, C=1100, D=1101, E=1110, F=1111. This lets you convert between hex and binary instantly by substituting each digit.



โ€ข Use octal for Unix file permissions: Unix permissions (read=4, write=2, execute=1) are naturally represented in octal. 755 means rwxr-xr-x: owner gets 7 (4+2+1), group and others get 5 (4+0+1).



โ€ข Remember powers of 2: Memorizing powers of 2 up to 2ยนโฐ (1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024) makes mental binary-to-decimal conversion much faster and helps you quickly estimate binary number sizes.



โ€ข Group binary digits for readability: When writing long binary numbers, group digits in sets of 4 (nibbles) or 8 (bytes) for readability: 1101 0011 1010 0001 is much easier to read than 1101001110100001.



โ€ข Verify your conversions bidirectionally: After converting a number, convert the result back to the original base to verify correctness. This catches transcription errors and builds confidence in your results.



โ€ข Use hex for color codes in web development: CSS colors like #FF5733 are hexadecimal: FF=255 red, 57=87 green, 33=51 blue. Understanding this mapping helps you tweak colors by adjusting hex values directly without a color picker.

Frequently Asked Questions

Related Tools

Explore more tools that might help you