๐Ÿ”ข Number Base Converter

Convert numbers between different number systems: binary (base 2), octal (base 8), decimal (base 10), and hexadecimal (base 16). Free online number base converter with real-time conversion.

Uses digits 0-9

Uses digits 0-9, A-F

Uses digits 0-9. Prefix none is optional.

Common Number Conversions

DecimalBinaryOctalHexadecimal
0000
1111
21022
81000108
10101012A
16100002010
25511111111377FF
256100000000400100
1024100000000002000400

What is a Number Base?

A number base (also called radix) is the number of unique digits, including zero, used to represent numbers in a positional numeral system. The most common number base is 10 (decimal), which we use in everyday life. However, computers and programming languages often use different bases like binary (base 2), octal (base 8), and hexadecimal (base 16).

Each position in a number represents a power of the base. For example, in decimal (base 10), the number 123 represents (1 ร— 10ยฒ) + (2 ร— 10ยน) + (3 ร— 10โฐ) = 100 + 20 + 3 = 123.

Number Systems Explained

Binary (Base 2)

Uses only two digits: 0 and 1. This is the fundamental number system used by computers.

Example: 1010 in binary = 10 in decimal

Prefix: 0b or 0B

Octal (Base 8)

Uses digits 0 through 7. Less common but still used in some Unix file permissions.

Example: 755 in octal = 493 in decimal

Prefix: 0o or 0O

Decimal (Base 10)

Uses digits 0 through 9. This is the standard number system we use in daily life.

Example: 42 in decimal = 42

Prefix: None

Hexadecimal (Base 16)

Uses digits 0-9 and letters A-F (or a-f). Very common in programming and web development for colors and memory addresses.

Example: FF in hexadecimal = 255 in decimal

Prefix: 0x or 0X

Common Use Cases

Programming: Converting between number bases is essential in programming, especially when working with bitwise operations, memory addresses, or color codes.
Web Development: Hexadecimal is commonly used for CSS color codes (e.g., #FF5733 for colors).
Computer Science: Understanding binary is fundamental to understanding how computers work at the lowest level.
File Permissions: Unix/Linux file permissions are often represented in octal (e.g., 755, 644).
Debugging: When debugging programs, you may need to convert between bases to understand memory dumps or error codes.
Networking: IP addresses and network configurations sometimes use different number bases.

Conversion Examples

Decimal to Binary

To convert 42 from decimal to binary:

42 รท 2 = 21 remainder 0
21 รท 2 = 10 remainder 1
10 รท 2 = 5 remainder 0
5 รท 2 = 2 remainder 1
2 รท 2 = 1 remainder 0
1 รท 2 = 0 remainder 1

Reading remainders from bottom to top: 101010
So 42 (decimal) = 101010 (binary)

Binary to Hexadecimal

To convert 101010 from binary to hexadecimal:

Group binary digits into groups of 4 from right:
101010 โ†’ 0010 1010

Convert each group:
0010 = 2 (decimal) = 2 (hex)
1010 = 10 (decimal) = A (hex)

So 101010 (binary) = 2A (hexadecimal)

Hexadecimal to Decimal

To convert FF from hexadecimal to decimal:

F = 15 (decimal)
FF = (15 ร— 16ยน) + (15 ร— 16โฐ)
   = (15 ร— 16) + (15 ร— 1)
   = 240 + 15
   = 255

So FF (hexadecimal) = 255 (decimal)

Tips for Using Number Base Converter

  • โœ“Prefixes: You can include prefixes (0x, 0b, 0o) in your input, or omit them. The converter will automatically detect and handle them.
  • โœ“Case Sensitivity: Hexadecimal letters (A-F) are case-insensitive. The converter will automatically uppercase the output.
  • โœ“Whitespace: Spaces in your input will be automatically removed during conversion.
  • โœ“Validation: The converter validates input according to the selected base to ensure accurate conversions.
  • โœ“Real-time: Enable auto-convert for instant conversion as you type, or disable it for manual control.
  • โœ“Swap: Use the swap button to quickly exchange the input and output bases.