Base Converter
Convert numbers between binary, octal, decimal, and hexadecimal. Supports arbitrary precision with BigInt. All conversion happens in your browser.
Input
Output
How to Use the Base Converter
Select the base of your input number using the BIN, OCT, DEC, or HEX buttons, then type or paste your number into the input field. The tool instantly shows the equivalent value in all four bases at the same time, so you can compare representations without running multiple conversions.
Common programming prefixes are handled automatically. If you paste 0xFF from a JavaScript file, the tool strips the 0x prefix and treats the value as hexadecimal. Similarly, 0b1010 is recognized as binary and 0o755 as octal. This means you can copy values directly out of your source code without manually removing the prefix first.
The tool uses JavaScript's BigInt under the hood, which means it handles arbitrarily large numbers without the rounding errors that affect standard floating-point arithmetic. This is important when working with 64-bit integers, large memory addresses, or cryptographic values that exceed the safe integer range of regular JavaScript numbers. Input is accepted up to 1MB in size, so even very long binary strings are supported. All computation happens in your browser — nothing is sent to a server.
What is Number Base Conversion?
A number base (also called a radix) defines how many unique digits a positional numeral system uses before it carries over to the next position. Decimal — the system humans use daily — has ten digits (0 through 9) and is base 10. Binary uses only two digits (0 and 1) and is base 2. Octal uses eight digits (0 through 7) and is base 8. Hexadecimal uses sixteen symbols (0 through 9 plus A through F) and is base 16.
Every number in any base can be expressed as a sum of powers of that base. The decimal number 255, for example, equals 2×10² + 5×10¹ + 5×10⁰. In binary it is 11111111, because that is the sum of eight powers of 2 (2⁷ + 2⁶ + … + 2⁰). In hexadecimal it is FF, because F represents 15, and 15×16¹ + 15×16⁰ = 240 + 15 = 255.
Developers need to convert between bases constantly because different layers of the computing stack use different representations. Hardware and networking protocols operate in binary, memory addresses are conventionally displayed in hexadecimal, Unix permissions are written in octal, and human-readable quantities use decimal. Fluency with base conversion is a foundational developer skill.
Common Use Cases
Reading memory addresses and debugger output is the most frequent hexadecimal use case. When you inspect a crash dump, set a breakpoint, or read a disassembly listing, addresses appear as hex values like 0x7ffee4b2c8a0. Converting these to decimal or binary can help you understand alignment, offsets, and address ranges.
Bit manipulation and bitmasks are easier to reason about in binary. If you are working with permission flags, network protocol fields, or hardware registers, converting your mask to binary lets you see exactly which bits are set. Cross-checking with hexadecimal gives you the compact representation you need for code.
Unix file permissions use octal notation. The chmod 755 command sets permissions where 7 is read+write+execute (binary 111), 5 is read+execute (binary 101), and so on. Converting between octal and binary makes it easy to understand what each permission digit actually enables.
CSS and HTML color codes are hexadecimal. The color #FF5733 encodes red as FF (255 decimal), green as 57 (87 decimal), and blue as 33 (51 decimal). Use this tool alongside the Color Converter when working with color arithmetic or palette generation.
Debugging encoded data such as JWT tokens, byte arrays, or hash outputs often requires converting between hex and decimal to compare values or verify checksums. See also the Hash Generator for generating and comparing hash values. For a deeper reference on number systems, see the Number Base Systems Guide.
Best Practices & Tips
Use standard prefixes in your code to make the base unambiguous for anyone reading it. Write 0xFF instead of 255 when you mean a hex byte value, 0b11110000 for a bitmask, and 0o755 for a Unix permission value. This self-documents the intent and prevents off-by-one errors caused by misreading base.
Hexadecimal is the most practical base for day-to-day developer work. Its tight mapping to bytes (2 hex digits = 1 byte, 8 hex digits = 4 bytes / 32 bits) makes it the default representation in debuggers, memory viewers, network analyzers, and cryptographic libraries. When in doubt about which non-decimal base to use for display, hex is almost always the right choice.
Binary is the clearest base for bitwise operations. When you are writing a bitmask or checking which flags are set in a status register, convert the value to binary first. The individual bits are visible at a glance, and you can verify your AND, OR, XOR, and shift operations directly against the bit pattern.
Octal is primarily a Unix legacy. Outside of file permissions and some older C codebases, octal is rarely encountered in modern development. Be careful with JavaScript numeric literals — a leading zero in older JS engines signaled octal, which caused subtle bugs. Modern JavaScript uses the explicit 0o prefix to avoid ambiguity.
Quick Reference: 0–15
| DEC | BIN | OCT | HEX |
|---|---|---|---|
| 0 | 0000 | 0 | 0 |
| 1 | 0001 | 1 | 1 |
| 2 | 0010 | 2 | 2 |
| 3 | 0011 | 3 | 3 |
| 4 | 0100 | 4 | 4 |
| 5 | 0101 | 5 | 5 |
| 6 | 0110 | 6 | 6 |
| 7 | 0111 | 7 | 7 |
| 8 | 1000 | 10 | 8 |
| 9 | 1001 | 11 | 9 |
| 10 | 1010 | 12 | A |
| 11 | 1011 | 13 | B |
| 12 | 1100 | 14 | C |
| 13 | 1101 | 15 | D |
| 14 | 1110 | 16 | E |
| 15 | 1111 | 17 | F |
FAQ
What number bases are supported?
Binary (base 2), Octal (base 8), Decimal (base 10), and Hexadecimal (base 16). The tool converts to all four simultaneously.
Is there a size limit?
The tool uses BigInt for arbitrary precision, so it handles very large numbers without floating-point rounding errors. Input is limited to 1MB.
Is my data safe?
Yes. All conversion happens in your browser. No data is sent to any server.
Why do programmers use hexadecimal so often?
One hex digit represents exactly 4 binary bits (a nibble), so two hex digits represent one byte. This makes hex a compact and readable shorthand for binary data — far easier to scan than a long string of 0s and 1s, and more meaningful than decimal for byte-level work.
What do the 0x, 0b, and 0o prefixes mean?
These are standard programming prefixes indicating number base: 0x for hexadecimal, 0b for binary, and 0o for octal. This tool strips them automatically so you can paste values from code without editing them first.