Number Base Converter
Convert between binary, octal, decimal, and hex
Input
Conversions
How to use the Number Base Converter
- •Enter a number in any of the four input fields: binary (base 2), octal (base 8), decimal (base 10), or hexadecimal (base 16).
- •See instant conversions as all other fields update simultaneously. Type in the decimal field and see binary, octal, and hex values appear in real-time.
- •Verify your input with the built-in validation. The tool highlights errors if you enter invalid digits for the selected base (e.g., a
2in a binary field). - •Copy any result to use in your code, documentation, or calculations.
What are Number Bases?
A number base (or radix) determines how many unique digits are used to represent numbers. We use base 10 (decimal) in everyday life because we have 10 fingers, but computers work in base 2 (binary) because digital circuits have two states: on (1) and off (0).
Binary (base 2) uses digits 0 and 1. Every piece of data in a computer -- text, images, programs -- is ultimately represented in binary. The number 42 in binary is 101010: (1x32) + (0x16) + (1x8) + (0x4) + (1x2) + (0x1).
Octal (base 8) uses digits 0-7. It was historically popular because each octal digit represents exactly 3 binary digits (bits), making it a compact way to express binary values. It is still used in Unix file permissions (e.g., chmod 755 means rwxr-xr-x).
Decimal (base 10) uses digits 0-9. This is the system humans use universally for counting, arithmetic, and most everyday purposes.
Hexadecimal (base 16) uses digits 0-9 and letters A-F (where A=10, B=11, ..., F=15). Each hex digit represents exactly 4 bits (a nibble), so two hex digits represent one byte (8 bits). This makes hex the preferred notation for memory addresses, color codes (#FF8800), MAC addresses (00:1A:2B:3C:4D:5E), and binary data dumps.
The conversion between bases follows a consistent pattern: to convert from any base to decimal, multiply each digit by its positional power of the base and sum the results. To convert from decimal to any base, repeatedly divide by the target base and collect the remainders.
Common use cases
- •Low-level programming: Working with bitwise operations, memory addresses, register values, and hardware interfaces requires fluency in binary and hexadecimal.
- •Debugging: Memory dumps, network packet captures, and core dumps display data in hexadecimal. Converting to decimal helps interpret values.
- •Unix permissions: Understanding octal notation is essential for
chmodcommands and interpreting file permission strings in Linux/macOS. - •Color codes: Web developers frequently convert between decimal RGB values and hexadecimal color codes.
- •Networking: Subnet masks, IP addresses (especially IPv6), and MAC addresses use hexadecimal notation.
FAQ
Q: Can I convert very large numbers? A: The tool handles numbers within JavaScript's safe integer range (up to 2^53 - 1, or 9,007,199,254,740,991 in decimal). For numbers larger than this, floating-point precision limitations may cause inaccuracies.
Q: Why is hexadecimal so common in programming? A: Because each hex digit maps exactly to 4 binary digits, it provides a compact, human-readable representation of binary data. One byte (8 bits) is always exactly 2 hex digits, making it easy to read and write binary values without long strings of 0s and 1s.
Q: How do I tell which base a number is in?
A: By convention, binary numbers are prefixed with 0b (e.g., 0b101010), octal with 0o (e.g., 0o52), and hexadecimal with 0x (e.g., 0x2A). Without a prefix, decimal is assumed. This tool labels each field clearly to avoid ambiguity.
Is my data safe?
Yes. This tool runs entirely in your browser. Your data is never sent to our servers.
How to use the Number Base Converter
- Enter a number in any of the four input fields: binary (base 2), octal (base 8), decimal (base 10), or hexadecimal (base 16).
- See instant conversions as all other fields update simultaneously. Type in the decimal field and see binary, octal, and hex values appear in real-time.
- Verify your input with the built-in validation. The tool highlights errors if you enter invalid digits for the selected base (e.g., a
2in a binary field). - Copy any result to use in your code, documentation, or calculations.
What are Number Bases?
A number base (or radix) determines how many unique digits are used to represent numbers. We use base 10 (decimal) in everyday life because we have 10 fingers, but computers work in base 2 (binary) because digital circuits have two states: on (1) and off (0).
Binary (base 2) uses digits 0 and 1. Every piece of data in a computer -- text, images, programs -- is ultimately represented in binary. The number 42 in binary is 101010: (1x32) + (0x16) + (1x8) + (0x4) + (1x2) + (0x1).
Octal (base 8) uses digits 0-7. It was historically popular because each octal digit represents exactly 3 binary digits (bits), making it a compact way to express binary values. It is still used in Unix file permissions (e.g., chmod 755 means rwxr-xr-x).
Decimal (base 10) uses digits 0-9. This is the system humans use universally for counting, arithmetic, and most everyday purposes.
Hexadecimal (base 16) uses digits 0-9 and letters A-F (where A=10, B=11, ..., F=15). Each hex digit represents exactly 4 bits (a nibble), so two hex digits represent one byte (8 bits). This makes hex the preferred notation for memory addresses, color codes (#FF8800), MAC addresses (00:1A:2B:3C:4D:5E), and binary data dumps.
The conversion between bases follows a consistent pattern: to convert from any base to decimal, multiply each digit by its positional power of the base and sum the results. To convert from decimal to any base, repeatedly divide by the target base and collect the remainders.
Common use cases
- Low-level programming: Working with bitwise operations, memory addresses, register values, and hardware interfaces requires fluency in binary and hexadecimal.
- Debugging: Memory dumps, network packet captures, and core dumps display data in hexadecimal. Converting to decimal helps interpret values.
- Unix permissions: Understanding octal notation is essential for
chmodcommands and interpreting file permission strings in Linux/macOS. - Color codes: Web developers frequently convert between decimal RGB values and hexadecimal color codes.
- Networking: Subnet masks, IP addresses (especially IPv6), and MAC addresses use hexadecimal notation.
FAQ
Q: Can I convert very large numbers? A: The tool handles numbers within JavaScript's safe integer range (up to 2^53 - 1, or 9,007,199,254,740,991 in decimal). For numbers larger than this, floating-point precision limitations may cause inaccuracies.
Q: Why is hexadecimal so common in programming? A: Because each hex digit maps exactly to 4 binary digits, it provides a compact, human-readable representation of binary data. One byte (8 bits) is always exactly 2 hex digits, making it easy to read and write binary values without long strings of 0s and 1s.
Q: How do I tell which base a number is in?
A: By convention, binary numbers are prefixed with 0b (e.g., 0b101010), octal with 0o (e.g., 0o52), and hexadecimal with 0x (e.g., 0x2A). Without a prefix, decimal is assumed. This tool labels each field clearly to avoid ambiguity.
Is my data safe?
Yes. This tool runs entirely in your browser. Your data is never sent to our servers.