Number Base Converter
Convert numbers between decimal, binary, octal, and hexadecimal. Instant results as you type.
Enter a number in decimal, binary, octal, or hexadecimal to see it converted to all other bases simultaneously. Results are best for integers within JavaScript's safe integer range.
Use it for byte values, colour channels, file permissions, subnet masks, and other everyday developer conversions. Very large integers need a BigInt-based converter.
Good to know before converting bases
Each base has its own valid digit set. A value that is valid in one base can be invalid in another, such as 8 in octal or G in hexadecimal.
Binary groups bits
Eight binary digits make one byte. Four binary digits map neatly to one hexadecimal digit.
Octal is strict
Octal only accepts 0 to 7. It is mainly useful for Unix file permission values such as 755.
Hex is case-insensitive
ff and FF represent the same value, 255.
Watch the safe limit
JavaScript numbers lose precision past 9,007,199,254,740,991, so do not use this page for huge cryptographic integers.
Prefixes are not required
Enter FF for hex rather than 0xFF; choose the base from the dropdown.
Leading zeros are display choices
The converter returns the numeric value, so padding such as 00001111 may be removed.
Negative values keep the sign
The minus sign is preserved while the magnitude is converted between bases.
Colour work uses bytes
Each RGB colour channel is a decimal byte from 0 to 255, or hex from 00 to FF.
Output is uppercase for hex
Uppercase A to F keeps hexadecimal output easy to scan beside colour and memory values.
Number Bases: How Computers Count
Humans count in base 10 (decimal) because we have 10 fingers. Computers count in base 2 (binary) because transistors have two states: on and off. But binary is tedious for humans, 11111111 is easier to read as FF (hexadecimal, base 16) or 255 (decimal).
Hexadecimal (base 16) is everywhere in computing: colour codes (#FF5733), memory addresses, MAC addresses, and Unicode code points. Octal (base 8) appears in Unix file permissions (chmod 755). Binary shows up when working with bitwise operations, network masks, and low-level protocols.
This converter works with the four bases developers reach for most: binary, octal, decimal, and hexadecimal. Enter a number in any of those bases, select which one it is, and see it expressed in all four simultaneously. Negative values are supported; for very large integers, precision is limited to JavaScript's safe integer ceiling of 2^53 minus 1 (9,007,199,254,740,991).
Common Number Bases
| Base | Name | Digits Used | Where You See It |
|---|---|---|---|
| 2 | Binary | 0, 1 | Low-level computing, network masks, flags |
| 8 | Octal | 0 to 7 | Unix file permissions (chmod 755) |
| 10 | Decimal | 0 to 9 | Everyday numbers, most user interfaces |
| 16 | Hexadecimal | 0 to 9, A to F | Colours (#FF5733), addresses, UUIDs |
| 32 | Base32 | A to Z, 2 to 7 | TOTP secrets (2FA authenticator apps) |
| 36 | Base36 | 0 to 9, A to Z | URL shorteners, compact IDs |
What this means for you: Most developers only need decimal, hexadecimal, and binary. Octal matters for Unix permissions. Base36 is useful for short URL-safe identifiers (toString(36) in JavaScript).
Practical Base Conversion Examples
| Decimal | Binary | Hex | Octal | Context |
|---|---|---|---|---|
| 255 | 11111111 | FF | 377 | Max byte value, RGB channel max |
| 420 | 110100100 | 1A4 | 644 | Unix file permission (rw-r--r--) |
| 493 | 111101101 | 1ED | 755 | Unix file permission (rwxr-xr-x) |
| 65535 | 1111111111111111 | FFFF | 177777 | Max 16-bit unsigned integer |
| 16777215 | 111111111111111111111111 | FFFFFF | 77777777 | White colour (#FFFFFF) |
Quick Conversion Tricks
Hex → Binary (by hand)
Each hex digit maps to exactly 4 binary digits. F = 1111, A = 1010, 0 = 0000. So FF = 11111111, and A3 = 10100011. This is why hex and binary are so closely related.
Powers of 2 to memorise
2⁸ = 256, 2¹⁰ = 1024 (1K), 2¹⁶ = 65536, 2³² = ~4.3 billion. These come up constantly in byte limits, colour depth, integer ranges, and memory addressing.
JavaScript shortcuts
0xFF (hex), 0b11111111 (binary), 0o377 (octal), all equal 255 in JS. Use parseInt("FF", 16) and (255).toString(16) for conversions in code.
Subnet masks
255.255.255.0 in binary is 11111111.11111111.11111111.00000000, that's /24 in CIDR notation. Understanding binary makes network masks intuitive.
Worked Base Conversion Example
A common developer example is the Unix permission value 755. In octal, each digit maps to a permission group.
Octal
755
Owner, group, others
Binary groups
111 101 101
Read, write, execute flags
Decimal
493
Same numeric value
In permission notation, 7 means read, write, and execute. 5 means read and execute. Seeing the binary groups makes the flag pattern easier to remember.
Common Base Conversion Mistakes
Entering prefixes in the wrong field
Choose the base from the selector, then enter the raw digits. Prefixes such as 0x are useful in code but are not needed here.
Expecting padding to stay
Leading zeros can be meaningful in fixed-width binary displays, but they do not change the numeric value.
Using invalid digits
Binary accepts only 0 and 1. Octal accepts 0 to 7. Hexadecimal accepts 0 to 9 and A to F.
Ignoring precision limits
JavaScript numbers are precise for integers up to 2^53 - 1. Large identifiers may need BigInt tooling.
Related Tools
How to use this tool
Enter a number in the input field
Select the base your number is in (decimal, binary, octal, or hex)
See instant conversions to all four bases
Common uses
- Converting hex colour codes to RGB decimal values
- Understanding Unix file permissions in octal
- Working with binary subnet masks and IP addresses
- Debugging memory addresses and byte values in hex
Share this tool
Frequently Asked Questions
What is a number base?
Why do developers use hexadecimal?
What is octal?
How do I convert binary to decimal manually?
What does 0x mean in code?
Why are colours written in hexadecimal?
What's the largest number this tool can convert?
How is base 36 useful?
What's the connection between binary and file sizes?
Why do MAC addresses use hexadecimal?
Is the conversion done on a server?
How do subnet masks relate to binary?
Results are for general informational purposes only and should be checked before use. They are not professional advice. See our Disclaimer and Terms of Service.