Number Base Converter
Convert between decimal, hexadecimal, binary, and octal — all at once, any size integer.
Input base
Decimal (base 10)
255
Hexadecimal (base 16)
FF
Binary (base 2)
1111 1111
Octal (base 8)
377
Number base conversion explained
Computers work in binary (base 2). Hexadecimal (base 16) is a compact human-readable form — each hex digit is exactly 4 bits. Octal (base 8) was popular in older systems and Unix file permissions. This converter handles arbitrarily large integers using JavaScript's BigInt, so there's no 32-bit or 64-bit overflow. For individual conversion tools, try Decimal to Binary or Hex to Decimal.
Built and maintained by Meet Shah · Last updated
What this tool is used for
- Moving one value between decimal, hex, binary and octal without three separate conversions.
- Checking a value's representation in every base at once while debugging.
- Confirming a bitmask looks right in binary and compact in hex simultaneously.
- Converting between two non-decimal bases without doing decimal in your head.
- Reading a value quoted in an unfamiliar base in a specification.
Frequently Asked Questions
- Is there a size limit?
- No practical one — conversion runs on BigInt, so a 200-digit number converts exactly. This matters because the usual JavaScript approach (`parseInt` and `toString`) loses precision above 2⁵³, silently rounding a 17-digit decimal before you ever see it.
- How are negative numbers shown?
- As a magnitude with a sign, not as two's complement. −5 in binary reads 101 with a minus, not 11111011 — because two's complement needs a fixed register width (8, 16, 32 bits) and a base converter has none. For the bit pattern, use a two's complement converter.
- Why are the bits grouped in fours?
- Because each group of four bits is exactly one hexadecimal digit — 1111 is F, 1010 is A — so a grouped binary string can be read off as hex by eye. Octal groups in threes for the same reason, which is why file permissions are written 755.
- Can I paste 0x, 0b or 0o prefixes?
- Yes; the prefix for the selected base is added for you if it is missing, so `FF` and `0xFF` both work in hex mode. What will not work is pasting hex digits while decimal is selected — `FF` is not a decimal number and the input is rejected rather than partially read.
- Why does hex use letters at all?
- Because base 16 needs sixteen symbols and the digits run out at 9, so A–F stand for 10–15. Hex survives because it maps cleanly onto bytes: two hex digits are exactly one byte, which is why colours, memory addresses and hashes are all written that way.
Common errors and gotchas
- Not stating the source base, where a string of digits is valid in several and means different things in each.
- Losing width information, so a mask's leading zeros disappear and bit positions shift.
- Treating a value as signed without fixing the width, which two's complement requires.
- Including a prefix in the digits, so `0x1F` is read as digits rather than as a marked hex value.
- Converting a fractional value and expecting exactness, when most fractions do not terminate in another base.
Related Converters tools
JSON to YAML
Convert JSON into clean, readable YAML instantly.
YAML to JSON
Convert YAML configuration into valid JSON.
JSON to XML
Convert JSON structures into nested XML markup.
HWB to HEX Converter
Convert an HWB color to HEX.
JSON to SQL
Turn a JSON array of objects into SQL INSERT statements.
CSV to XML
Convert CSV rows into structured XML records.
XML to CSV
Flatten repeated XML records into CSV rows.
INI to JSON
Parse INI config sections and keys into JSON.