AbraCalc

Number Base Converter

Convert integers between decimal, binary, octal, and hexadecimal number systems.

Embed this tool on your site
Cite this tool

APA

AbraCalc. (2026). Number Base Converter [Online calculator]. Retrieved from https://abracalc.com/converter/numeric-base-multi-converter/

BibTeX

@misc{abracalc-numeric-base-multi-converter, author = {AbraCalc}, title = {Number Base Converter}, year = {2026}, howpublished = {\url{https://abracalc.com/converter/numeric-base-multi-converter/}} }

Did this tool answer your question?

How to use this tool

  1. Enter number and from base in the fields above.
  2. Results update instantly as you type — or click Calculate.
  3. Read your hexadecimal and the full breakdown beneath it.

Formula

Parse the input string in the source base using parseInt(s, base) to get an integer n, then re-express n in each target base:

decimal = n  |  binary = n.toString(2)  |  octal = n.toString(8)  |  hex = n.toString(16)

How it works

The converter parses the input as an integer in the declared source base (2, 8, 10, or 16), stores the resulting native integer value, then re-serialises it using JavaScript's built-in toString(base) method for each target radix. No floating-point arithmetic is involved — the conversion is exact for any integer within JavaScript's safe integer range (up to 253 − 1).

Common mistake: Hexadecimal digits A–F are case-insensitive in parsing, but people often forget that hex output is lowercase by default (e.g. ff, not FF). More importantly, this converter handles non-negative integers only — entering a negative sign or a decimal point will produce NaN.

Worked example

Convert decimal 255 to binary, octal, and hexadecimal

  1. Input: 255 in decimal (base 10).
  2. Parse: parseInt('255', 10) = 255.
  3. Binary: 255 = 128+64+32+16+8+4+2+1 = 11111111₂.
  4. Octal: 255 = 3×64 + 7×8 + 7 = 377₈; Hex: 255 = 15×16 + 15 = ff₁₆.

255 decimal = 11111111 binary, 377 octal, ff hexadecimal.

Common mistakes to avoid

  • Including invalid digits for the source base -- hexadecimal uses 0-9 and A-F; entering G or beyond causes a parse error, and binary only accepts 0 and 1.
  • Forgetting that this converter handles integers only -- fractional hex or binary values (e.g. 0.5 in hex is 0.8 in decimal) require a separate fractional base conversion algorithm.
  • Assuming leading zeros in binary output are meaningful -- 0001101 and 1101 represent the same value (13 decimal); padding is for alignment only.

Key terms

Binary (base 2)
A numeral system using only digits 0 and 1. It is the native language of digital hardware, where each digit corresponds to one bit (high or low voltage).
Octal (base 8)
A numeral system using digits 0–7. Each octal digit maps exactly to three binary digits, making it a convenient shorthand in older Unix and embedded-systems contexts.
Decimal (base 10)
The standard numeral system using digits 0–9. All positional values are powers of ten.
Hexadecimal (base 16)
A numeral system using digits 0–9 and letters A–F. Each hex digit represents exactly four binary bits (a nibble), making it the most compact human-readable way to express binary data.

Frequently asked questions

Why does computer memory use binary?
Binary (base 2) maps directly to electronic on/off states (high/low voltage). Representing two states is far more reliable and noise-tolerant in physical circuits than representing 10 states (decimal), making binary the natural foundation of digital hardware.
What is hexadecimal used for in programming?
Hex (base 16) compactly represents binary data: one hex digit maps to exactly four binary bits. A byte (8 bits) becomes two hex digits. This makes hex convenient for memory addresses, color codes (e.g. #FF5733), and byte-level debugging.
How do I convert decimal 255 to hexadecimal manually?
Divide repeatedly by 16: 255 / 16 = 15 remainder 15. In hex, 15 = F. So 255 decimal = FF hex. This is also the maximum value of a single byte and the value used for full intensity in RGB color channels.

References & sources