Number Base Converter
Convert any integer between binary (base 2), octal (base 8), decimal (base 10), and hexadecimal (base 16). Backed by JavaScript's BigInt for arbitrarily large integers — handle numbers far beyond JavaScript's safe-integer limit of 9,007,199,254,740,991. Bidirectional editing means changing any field instantly updates all others.
What does this tool do?
The Number Base Converter provides bidirectional conversion between the four most common number bases used in computing and digital systems. It accepts numbers in any of the four bases and instantly displays equivalent values in the other three. Using BigInt internally, it handles numbers with thousands of digits without precision loss. The interface accepts common input formats including prefixes (0b for binary, 0o for octal, 0x for hex) and underscore separators for readability.
How it works
Input values are parsed using BigInt with automatic radix detection from prefixes (0b, 0o, 0x) or from the input field context. The BigInt value is then converted to each output base using toString(radix). Binary uses base 2 with digits 0-1. Octal uses base 8 with digits 0-7. Decimal uses base 10 with digits 0-9. Hexadecimal uses base 16 with digits 0-9 and a-f. Invalid characters for a given base are detected and rejected with clear feedback. The bidirectional binding means editing any field immediately recalculates and updates all other fields.
Features
- Four bases: binary, octal, decimal, hexadecimal
- BigInt-backed: arbitrary-precision integers
- Bidirectional: edit any field, all others update
- Accepts prefixes (0b, 0o, 0x) and underscore separators
- Per-field copy buttons
- Input validation with clear error feedback
- Handles thousands of digits
How to use
- 1
Enter a number
Type into any of the four fields using that base's valid digits. The other three fields update instantly with converted values.
- 2
Use prefixes for clarity
Enter 0b1010 for binary, 0o755 for octal, 0xFF for hex. The tool recognizes and strips these standard prefixes automatically.
- 3
Add underscores for readability
JavaScript BigInt allows underscores as digit separators: 1_000_000 or 0xFF_FF. These are accepted and processed correctly.
- 4
Copy any format
Click the copy button next to any field to copy that base representation to your clipboard for use in code, documentation, or calculations.
Common use cases
Programming and debugging
Convert between hex color codes, binary bitmasks, decimal constants, and octal file permissions while coding or debugging.
Digital logic design
Electrical engineers and students convert between binary (logic levels), hex (compact representation), and decimal (human-readable) for circuit design.
Cryptocurrency and blockchain
Work with hex addresses, convert wei to ether denominations, and handle large integers common in blockchain applications.
Computer science education
Students learning number systems can verify their manual conversions and explore how large numbers behave across different bases.
Tips & best practices
- Hexadecimal (base 16) is compact for binary data — each hex digit represents exactly 4 bits (a nibble)
- Octal (base 8) is still used for Unix/Linux file permissions (chmod 755) and some legacy systems
- BigInt handles arbitrarily large numbers, but performance degrades with extremely large values (1000+ digits)
- Negative numbers are supported with a leading minus sign in any base