Number Base Converter
Convert numbers between binary, octal, decimal, and hexadecimal. Edit any field to update the rest.
What is number base conversion?
A number base (radix) is how many digit symbols you use. Binary uses 0 and 1, octal 0–7, decimal 0–9, hexadecimal 0–9 and A–F. The same magnitude can be written in any base: decimal 255 is binary 11111111, octal 377, and hex FF. Each hex digit is exactly four bits; each octal digit is three bits.
Four fields share one non-negative integer. Type in binary (digits 0–1), octal (0–7), decimal (0–9), or hexadecimal (0–9, A–F). Invalid characters are blocked as you type. The value is parsed with parseInt(text, radix), rejected if it is NaN or negative, then written back with Number#toString for the other radices. Hexadecimal is always upper case (FF, not ff). There is no 0x, 0b, or 0o prefix in the fields — those prefixes would fail the per-field character pattern. Quick values 0, 1, 255, 1024, and 65535 fill decimal and refresh the rest. Copy sits next to each field. All math is in the page; nothing is sent anywhere. For Unix permission bits rather than a raw integer, use the Chmod Calculator. For a longer write-up of bases, see the number-systems guide on the blog.
When to use this tool
- Bit patterns and masks — Enter a hex mask and read the binary bits, or the other way around, without a desk calculator.
- Unix mode bits as an integer — Octal 755 is decimal 493 and binary 111101101. For setuid/setgid/sticky labels, prefer Chmod Calculator. Chmod Calculator
- Color bytes and addresses — 255 decimal is FF hex — one byte. 1024 decimal is 400 hex, a common page-size related value.
- ASCII code points — Convert a code unit in decimal or hex, then look at characters in ASCII to Text if you need glyphs. ASCII to Text
How to use the Number Base Converter
Type in any one field
Binary, octal, decimal, or hex. Characters outside that base are ignored (they never appear in the input).
Read the other three
They update on each accepted keystroke. Hex digits are shown in A–F. Leading zeros you type in one field are not preserved after conversion because the value is an integer.
Use a quick value
The sidebar buttons set decimal to 0, 1, 255, 1024, or 65535 — handy for all-bits-one bytes and 16-bit limits.
Copy a field
Copy copies that field’s text. Clear resets all four.
Worked examples
One byte: decimal 255
255 (decimal)
binary 11111111 octal 377 decimal 255 hex FF
Hex FF is the same magnitude
FF (hexadecimal)
binary 11111111 octal 377 decimal 255 hex FF
Unix 755 octal as an integer
755 (octal)
binary 111101101 octal 755 decimal 493 hex 1ED
The binary grouping 111 101 101 is the same bits with spaces for rwx r-x r-x. The converter prints 111101101.
Decimal 1024
1024 (decimal)
binary 10000000000 octal 2000 decimal 1024 hex 400
Tips
- Hex output is upper case even if you type abc — it will normalize to ABC after conversion from another field.
- Very large integers are limited by JavaScript’s parseInt / Number range; this is not a BigInt converter.
- Binary 11111111, octal 377, decimal 255, and hex FF are the same byte.
- The blog post “Number Systems for Developers” walks through bit grouping in more depth.
Frequently Asked Questions
Why is hexadecimal used so often in programming?
Each hex digit is four bits, so two digits are a byte. FF is shorter than 11111111 and maps cleanly onto memory dumps and color bytes.
What does octal 755 mean for Unix files?
As an integer it is decimal 493. As a mode, the three digits are owner/group/other permission triples (rwx r-x r-x). Use Chmod Calculator when you care about symbolic modes and special bits.
Can I convert negative numbers or fractions?
No. parseInt must yield a value ≥ 0. Fractions and leading minus signs are rejected. Prefixes such as 0x are not accepted in the hex field — type FF, not 0xFF.
Are values sent to a server?
No. parseInt and toString run in the browser.