Beginner

Number Base Converter

Convert an integer between binary (base 2), octal (base 8), decimal (base 10) and hexadecimal (base 16).
Last updated: June 20, 2026 · Reviewed by TG we-Calculate Editorial Team
Enter digits valid for the chosen base

From base

Decimal value
10

Same integer shown in all four bases below.

Binary (base 2)
1010
Octal (base 8)
12
Decimal (base 10)
10
Hexadecimal (base 16)
A
1248Positional place values in base 2 (×2 each step)
Results are estimates for general information only and are not professional advice — always verify important results independently before relying on them. Read the full disclaimer.
Quick answer

How do you convert a number between bases?

To convert a number to base 10, multiply each digit by the base raised to its position (counting from zero on the right) and add the results. To go from decimal to another base, repeatedly divide by the target base and read the remainders bottom-up. This tool does both automatically.

Formula
value = Σ dᵢ × baseⁱ (each digit dᵢ is multiplied by the base raised to its position i)
How this is calculated

You supply two inputs: the value (a string of digits) and the "from base" (the radix that string is written in — 2, 8, 10 or 16). The converter first checks that every character is a legal digit for that base: base 2 allows only 0–1, base 8 allows 0–7, base 10 allows 0–9, and base 16 adds A–F (case-insensitive). If any character is out of range, the input is rejected rather than silently truncated.

The value is then decoded into a single decimal integer using positional notation: each digit is multiplied by the base raised to the power of its position, counting from zero on the right, and the products are summed. So binary 1010 becomes 1×2³ + 0×2² + 1×2¹ + 0×2⁰ = 10. That one integer is the canonical value; it is re-encoded into all four bases for display, with hexadecimal shown in uppercase by convention.

The tool handles only non-negative whole numbers — no signs, fractions or separators. It also assumes exact integer arithmetic, so values above 2⁵³−1 (9,007,199,254,740,991) are rejected to avoid floating-point rounding errors.

Examples
InputResult
Binary 1010 → decimal10
Decimal 255 → hexadecimalFF
Hexadecimal 1F → octal37

Frequently asked questions

Hex digits A–F can be written in either case, but uppercase is the most common convention for memory addresses, colour codes and documentation, so the result uses uppercase.

This converter handles non-negative whole numbers (integers). Fractions and signs are not supported, since binary/octal/hex fractions follow separate rules.

Up to 9,007,199,254,740,991 (2⁵³−1), the largest integer JavaScript can represent exactly. Larger values are rejected to avoid rounding errors.

Also known as

binary to decimal
decimal to binary
hex to decimal
decimal to hexadecimal
octal converter
radix converter
base converter
convert number base

APA

TG we-Calculate Editorial Team. (2026). Number Base Converter [Online calculator]. TG we-Calculate. https://we-calculate.com/calculator/number-base-converter

Chicago

TG we-Calculate Editorial Team. "Number Base Converter." TG we-Calculate. 2026. https://we-calculate.com/calculator/number-base-converter.

IEEE

TG we-Calculate Editorial Team, "Number Base Converter," TG we-Calculate, 2026. [Online]. Available: https://we-calculate.com/calculator/number-base-converter

BibTeX

@misc{wecalculate_number_base_converter, title = {Number Base Converter}, author = {{TG we-Calculate Editorial Team}}, howpublished = {\url{https://we-calculate.com/calculator/number-base-converter}}, year = {2026}, note = {TG we-Calculate} }

Did this calculator help you?