Binary ↔ Decimal Converter
Convert between binary, decimal, hexadecimal, and octal.
📘 How It Works
Base Selection
Choose your input's number system: decimal (base 10), binary (base 2), hexadecimal (base 16), or octal (base 8). The tool interprets your input according to the selected base.
Parsing Input
JavaScript's parseInt(value, radix) converts the input string to a decimal integer. The radix parameter specifies the input's base (2, 8, 10, or 16).
Conversion Algorithm
The decimal value serves as an intermediate. From decimal, toString(base) converts to any target base. This two-step process handles all base combinations.
Simultaneous Output
All four representations are computed and displayed at once: decimal, binary, hexadecimal (uppercase), and octal. This enables easy comparison.
Validation
Invalid characters for the selected base trigger error handling. For example, '2' is invalid in binary (only 0-1 allowed), 'G' is invalid in hex (0-9, A-F only).
💡 Common Use Cases
Programming & Debugging
Developers work with hex for memory addresses, binary for bitwise operations, and need to convert between representations for debugging.
Computer Science Education
Students learning number systems can verify manual conversion calculations and understand base relationships.
Color Code Conversion
Web developers convert between RGB decimal values (255, 128, 0) and hexadecimal color codes (#FF8000).
File Permission Analysis
Unix file permissions use octal (755, 644). Convert to binary to understand read/write/execute bits.
Network Configuration
IP addresses and subnet masks are often expressed in binary for network calculations and decimal for configuration.
Digital Electronics
Hardware engineers work with binary for logic gates and need conversions for datasheets specifying values in hex or decimal.