Embed this tool on your site
About this tool
Programmers, embedded engineers, network administrators, and computer science students constantly work with numbers expressed in binary (base 2), octal (base 8), decimal (base 10), and hexadecimal (base 16). Manually converting between these bases is error-prone and slow, especially for large values. This base converter takes an integer in whichever of the four bases you choose and shows all four representations at once as you type. It uses JavaScript BigInt arithmetic, so very long values convert exactly with no rounding or 64-bit limit. Signed input is supported: a leading minus sign is kept in every output (for example −255 decimal is −FF hex), which is a sign-and-magnitude view rather than a two's complement bit pattern. Hex output is upper-case, and invalid digits — such as a 2 in binary or a 0x prefix — produce a clear error message instead of a wrong result. Everything runs in your browser.
Why use it
All Four Bases at Once: Enter a number in one base and see binary, octal, decimal and hexadecimal together. No sequential conversion steps.
Exact for Huge Numbers: BigInt arithmetic means 64-bit values, 128-bit hashes or longer integers convert exactly, without the rounding that ordinary floating-point converters introduce.
Signed Values: Negative integers are accepted in any base and keep their minus sign in every output, so −1010 in binary converts cleanly to −10 in decimal.
Clear Validation: Digits that do not belong to the chosen base are caught immediately with a message such as "Invalid base-16 integer.", so you never copy a silently wrong answer.
Fully Offline: All conversion logic is plain JavaScript with no external dependencies. Once the page is loaded it works without an internet connection.
How to use
- Choose the base of your number in the Input base dropdown: Binary, Octal, Decimal or Hex
- Type the integer in the Integer value field, with an optional + or - sign
- Leave out prefixes such as 0x or 0b — enter only the digits
- Read the Base 2, Base 8, Base 10 and Base 16 results, which update as you type
When it helps
- When reading a hardware datasheet or memory map that specifies register values in hexadecimal and you need the binary bit pattern to check individual flags
- When a Unix chmod permission value is given in octal (such as 755) and you want to see the read-write-execute bit pattern
- When a CSS colour channel is in hexadecimal (such as FF or 57) and you want its decimal 0–255 value
- When a computer science assignment asks you to convert decimal to binary by hand and you want to verify your work
- When a log or debugger prints a very large hex value and you need its exact decimal equivalent
Examples
01Decimal 255 to all bases
InputInput base: Decimal, value 255
Expected resultBase 2: 11111111 — Base 8: 377 — Base 16: FF
02Hex to decimal and binary
InputInput base: Hex, value CAFE
Expected resultBase 10: 51966 — Base 2: 1100101011111110 — Base 8: 145376
InputInput base: Octal, value 755
Expected resultBase 2: 111101101 — Base 10: 493 — Base 16: 1ED
Tips
- Group binary results into 4-bit nibbles mentally — each nibble maps to exactly one hex digit, making binary-to-hex conversion a visual pattern match
- Hex pairs map to bytes perfectly — a 4-byte (32-bit) value is exactly 8 hex characters, which makes hex ideal for reading memory dumps and packet captures
- Strip 0x, 0b or 0o prefixes before pasting a value — the tool expects digits only
- Negative results are shown with a minus sign, not as two's complement; for an 8-bit pattern of −1, convert 256 − 1 = 255 instead
- Octal is still used in Unix/Linux file permission modes: chmod 755 means owner read-write-execute, group read-execute, other read-execute
Frequently Asked Questions
What does the 0x prefix mean?⌄
The 0x prefix is a widely adopted convention in programming languages including C, C++, Java, Python, and JavaScript to indicate that the following number is in hexadecimal (base 16). For example, 0xFF means 255 in decimal. The prefix is not part of the value itself — it is purely a notation marker.
Why use hexadecimal instead of binary?⌄
Binary numbers for large values are very long and hard to read. Each hex digit represents exactly four binary bits (a nibble), so a 32-bit number that is 32 binary digits long becomes just 8 hex digits. This makes memory addresses, colour codes, and register values far more compact and readable without losing precision.
How does two's complement represent negative numbers?⌄
In two's complement, negative numbers are represented by inverting all bits of the positive value and then adding 1. For example, +1 in 8-bit binary is 00000001; −1 is 11111110 + 1 = 11111111 (0xFF in hex). The most significant bit serves as the sign bit: 0 means positive, 1 means negative.
What is the maximum value of an 8-bit, 16-bit, 32-bit integer?⌄
For unsigned integers: 8-bit max is 255 (0xFF), 16-bit is 65,535 (0xFFFF), 32-bit is 4,294,967,295 (0xFFFFFFFF). For signed two's complement: 8-bit ranges from −128 to +127, 16-bit from −32,768 to +32,767, and 32-bit from −2,147,483,648 to +2,147,483,647.
What is the difference between octal and hexadecimal?⌄
Octal (base 8) uses digits 0–7 and groups three binary bits per digit. It was historically common in older computing architectures and remains visible in Unix file permissions. Hexadecimal (base 16) uses digits 0–9 and A–F, grouping four binary bits per digit, and is far more prevalent in modern computing.
How do I convert binary to hex by hand?⌄
Group the binary number into 4-bit nibbles from right to left, padding with leading zeros if needed. Then convert each nibble to its hex equivalent: 0000=0, 0001=1, ..., 1010=A, 1011=B, 1100=C, 1101=D, 1110=E, 1111=F. For example, 11001010 = 1100 1010 = C A = 0xCA.
Can I convert fractions to other bases?⌄
This tool converts integers only. Fractional base conversion is a more complex process involving repeated multiplication, and results can be non-terminating in many bases. For example, 0.1 in decimal is a repeating fraction in binary (0.0001100110011...). Integer-only conversion covers the vast majority of programming and hardware use cases.
What base do MAC addresses and colours use?⌄
Both use hexadecimal (base 16). A MAC address like 00:1A:2B:3C:4D:5E has six pairs of hex digits representing six bytes. CSS and HTML colour codes like #FF5733 have three hex pairs representing red (FF=255), green (57=87), and blue (33=51) components as 0–255 values.
Glossary
- Binary (Base 2)
- A number system that uses only the digits 0 and 1. Every value is expressed as a sum of powers of 2. Binary is the native representation of digital logic because transistors have two states: on (1) and off (0).
- Octal (Base 8)
- A number system using digits 0–7. Each octal digit represents exactly three binary bits. Octal appears mainly in Unix file permission modes (chmod) and some older computing contexts.
- Decimal (Base 10)
- The standard everyday number system using digits 0–9. Each digit position represents a power of 10. Humans use decimal because we have ten fingers; computers use binary internally but often display results in decimal for readability.
- Hexadecimal (Base 16)
- A number system using digits 0–9 and letters A–F, where A=10 and F=15. Each hex digit represents exactly four binary bits (one nibble). Hexadecimal is the standard notation for memory addresses, colour codes, and machine-level values in computing.
- Two's Complement
- The most common method for representing signed (positive and negative) integers in binary. A negative number is obtained by inverting all bits of the positive representation and adding 1. The most significant bit acts as the sign bit.
- Bit / Byte / Nibble
- A bit is the smallest unit of binary data (0 or 1). A nibble is 4 bits, which maps to one hexadecimal digit. A byte is 8 bits (two nibbles), capable of representing 256 distinct values (0–255 unsigned).
A LITTLE HELP. A LOT DONE.
Good tools.
Great flow.
Your shortcut to the everyday. Create, convert, calculate,
and get back to what you love.
✳
✳
✓ Free to use✓ No sign-up✓ 500+ possibilities