internettoolbox
← Back to Tools

Number Converter

How it works

Pick the base you're starting from (decimal, binary, octal or hexadecimal) and type your number. The same value appears in all four bases at once, decimal, binary, octal and hex side by side, each with a one-click Copy button. Input is validated as you type: a digit that isn't legal for the chosen base (a '2' in a binary number, an '8' in octal, a 'G' in hex) is flagged straight away instead of returning a wrong answer. Your last ten conversions are kept under "Recent conversions" (stored locally in your browser), so you can jump straight back to a value you converted a minute ago; a Clear button wipes the list.

Why four bases? Every number you type is the same quantity, and only the notation changes. Decimal (base 10) is what humans count in because we have ten fingers. Computers work in binary (base 2) because a transistor is either on or off. Hexadecimal (base 16) and octal (base 8) are compact shorthands for binary that programmers read far more easily than long runs of ones and zeros.

Where each base shows up in real work: • Hexadecimal: memory addresses (0x7FFE…), CSS / HTML colours (#1A73E8), byte values in a hex editor, MAC addresses, Unicode code points (U+1F680) and bitmasks. One byte is exactly two hex digits (00–FF), which is why hex is the natural language of low-level data. • Binary: bit flags, register contents, network masks, and anywhere you need to see the individual bits. Reading binary is how you spot which single bit is set. • Octal: Unix / Linux file permissions (chmod 755, chmod 644), where each digit packs three permission bits, plus some legacy and embedded systems. • Decimal: human-facing numbers, so prices, counts and IDs.

How the conversion works. Each position in a number is worth the base raised to its position, counting from zero on the right. In hex, 0x1A is 1 × 16¹ + 10 (A) × 16⁰ = 26. The same value is 0b11010 in binary (16 + 8 + 2 = 26) and 032 in octal (3 × 8 + 2 = 26). That is four spellings of the one number twenty-six. The tool does this arithmetic both ways: it parses the digits of your input base into a single integer, then re-expresses that integer in each of the four bases.

Whole numbers up to JavaScript's safe-integer limit (2⁵³ − 1, about 9 quadrillion) convert exactly. The converter works on integers: a fractional part after a decimal point is ignored. Negative numbers are shown with a leading minus sign (signed-magnitude), not as a fixed-width two's-complement bit pattern.

Everything is computed locally in your browser with a handful of arithmetic operations. Nothing you type is uploaded, no network request is made (you can confirm in DevTools, Network tab), and the recent-conversions list never leaves your device.

Frequently Asked Questions

What bases are supported?

Decimal (base 10), binary (base 2), octal (base 8), and hexadecimal (base 16). The four most common bases for everyday programming, CTF challenges, file permissions and low-level debugging.

Can I convert large numbers?

Yes. Integers up to Number.MAX_SAFE_INTEGER (2^53 − 1 ≈ 9 quadrillion) are converted exactly. Very large values beyond that start losing precision in every base, so for 64-bit work copy the number through a BigInt-aware tool.

How do I convert decimal to binary by hand?

Repeatedly divide the decimal number by 2 and write down the remainder (0 or 1) each time; the binary digits are the remainders read from bottom to top. For 26: 26÷2=13 r0, 13÷2=6 r1, 6÷2=3 r0, 3÷2=1 r1, 1÷2=0 r1, and reading the remainders upward gives 11010. The same long-division method works for any base: divide by 8 for octal, by 16 for hex (using A–F for remainders 10–15). This tool does it for you, but the method is worth knowing for exams and interviews.

Why do programmers use hexadecimal instead of binary?

Because hex is binary, just four times shorter and far easier to read. Each hex digit maps to exactly four binary bits (0–F = 0000–1111), so one byte (eight bits) is always two hex digits. Pure white is 11111111 11111111 11111111 in binary but #FFFFFF in hex: a third of the characters, with no zeros to miscount. Hex keeps the bit-for-bit precision of binary while staying compact enough to write memory addresses, colour codes and byte dumps by hand.

What is octal used for?

Its most common modern use is Unix / Linux file permissions: chmod 755, chmod 644. Each octal digit (0–7) packs exactly three permission bits (read 4, write 2, execute 1), so 7 means rwx, 6 means rw-, 5 means r-x. Octal also turns up in some legacy systems and C-style numeric escapes. Outside permissions it has largely been replaced by hexadecimal, but it remains the clearest way to express three-bit groups.

Why does 0x1A equal 26 in decimal?

Each hex digit is worth 16ⁿ at position n from the right. 0x1A is 1 × 16 + 10 (A) × 1 = 26. The same position-weighting rule applies to every base: 0b11010 (binary) is 16 + 8 + 2 = 26, and 032 (octal) is 3 × 8 + 2 = 26. All four representations refer to the exact same number.

Can it convert negative numbers?

Yes. Type a leading minus sign and the converter shows the negative value in every base as signed-magnitude: −10 becomes −1010 in binary and −A in hex. Note this is not two's-complement, so it shows the magnitude with a minus sign rather than the fixed-width bit pattern a CPU stores for a negative integer. If you need the two's-complement representation for an 8-, 16- or 32-bit register, pick a width and compute it separately.

Does it convert numbers with a decimal point or fraction?

No. The converter works on whole numbers (integers) only. If you enter 3.75, the fractional part is ignored. Converting fractions between bases is a different operation (you multiply the fractional part by the target base repeatedly) and often produces a non-terminating expansion: 0.1 in decimal is 0.0001100110011… repeating in binary. For integer work, which covers the vast majority of programming and exam questions, this tool is all you need.

What's the difference between a bit, a nibble and a byte?

A bit is a single binary digit, 0 or 1. A nibble is four bits, which is exactly one hexadecimal digit (0–F). A byte is eight bits, or two hex digits, and holds 256 distinct values, 0 to 255 (or −128 to 127 if signed). These groupings are why byte values run 00–FF in hex and why a single colour channel maxes out at 255: it's one byte.

Are my recent conversions saved anywhere?

Your last ten conversions are stored in your browser's localStorage, so they survive a page reload and reappear when you come back. They never leave your device, and the Clear button erases the list immediately. Click any recent entry to reload that value and base.

Does the number converter send my values to a server?

No. The conversion is a handful of JavaScript arithmetic operations that run in your tab. No network call is made at any point, and you can confirm that from the DevTools Network tab.

Decimal → binary → octal → hex conversion chart

The base conversions people look up most: single digits, powers of two, and the byte boundaries (127, 255, 256, 65535). Every row is the same number written four ways.

DecimalBinaryOctalHexNote
0000
1111
21022
31133
410044
510155
611066
711177Largest single octal digit
81000108
91001119
10101012AHex digits A–F start here
11101113B
12110014C
13110115D
14111016E
15111117FOne full nibble (4 bits)
161000020102⁴
3111111371F
3210000040202⁵
641000000100402⁶
100110010014464
12711111111777FMax value of a signed byte (int8)
12810000000200802⁷
25511111111377FFMax value of one unsigned byte
2561000000004001002⁸, one full byte of values
1000111110100017503E8
10241000000000020004002¹⁰ = 1 KiB
409610000000000001000010002¹² = 4 KiB
655351111111111111111177777FFFFMax value of an unsigned 16-bit integer
6553610000000000000000200000100002¹⁶ = 64 KiB

Values are exact. Binary groups into nibbles (4 bits = 1 hex digit) and bytes (8 bits = 2 hex digits); the powers-of-two rows mark the limits of common integer sizes.

Tool switcher

Search and jump to any tool