Number Base Converter

Binary ⇄ decimal ⇄ hexadecimal ⇄ octal, with every step of the arithmetic.

Value

Input base

Display

Rounding

Textbooks usually truncate. State which your course expects.

Bit grouping

Binary

1101.101

7 digits · 1 byte

Octal

15.5

3 digits

Decimal

13.625

5 digits

Hexadecimal

D.A

2 digits

Note:

Group outward from the radix point: pad the integer side on the left and the fraction side on the right.

Working — binary

Base 10 to base 2

Convert 13.625 from base 10 to base 2. The sign is carried across unchanged; only the magnitude is converted.

Positional expansion of the input — Base 10 to base 2
digitvalueweightweight (base 10)digit x weight
1110^11010
3310^013
6610^-10.10.6
2210^-20.010.02
5510^-30.0010.005
total13.625

Integer part: divide by 2 and read the remainders bottom to top.

Read the last column bottom to top. ↑ — Base 10 to base 2
ndivide byquotientremainder
1313 ÷ 261
66 ÷ 230
33 ÷ 211
11 ÷ 201

Fraction part: multiply by 2 and read the digits top to bottom.

Read the last column top to bottom. ↓ — Base 10 to base 2
fractionmultiply byproductdigit
0.6250.625 × 21.251
0.250.25 × 20.50
0.50.5 × 211

13.625 (base 10)1101.101 (base 2)

Working — octal

Base 10 to base 8

Convert 13.625 from base 10 to base 8. The sign is carried across unchanged; only the magnitude is converted.

Positional expansion of the input — Base 10 to base 8
digitvalueweightweight (base 10)digit x weight
1110^11010
3310^013
6610^-10.10.6
2210^-20.010.02
5510^-30.0010.005
total13.625

Integer part: divide by 8 and read the remainders bottom to top.

Read the last column bottom to top. ↑ — Base 10 to base 8
ndivide byquotientremainder
1313 ÷ 815
11 ÷ 801

Fraction part: multiply by 8 and read the digits top to bottom.

Read the last column top to bottom. ↓ — Base 10 to base 8
fractionmultiply byproductdigit
0.6250.625 × 855

13.625 (base 10)15.5 (base 8)

Working — decimal

Base 10 to base 10

Convert 13.625 from base 10 to base 10. The sign is carried across unchanged; only the magnitude is converted.

Positional expansion of the input — Base 10 to base 10
digitvalueweightweight (base 10)digit x weight
1110^11010
3310^013
6610^-10.10.6
2210^-20.010.02
5510^-30.0010.005
total13.625

Integer part: divide by 10 and read the remainders bottom to top.

Read the last column bottom to top. ↑ — Base 10 to base 10
ndivide byquotientremainder
1313 ÷ 1013
11 ÷ 1001

Fraction part: multiply by 10 and read the digits top to bottom.

Read the last column top to bottom. ↓ — Base 10 to base 10
fractionmultiply byproductdigit
0.6250.625 × 106.256
0.250.25 × 102.52
0.50.5 × 1055

13.625 (base 10)13.625 (base 10)

Working — hexadecimal

Base 10 to base 16

Convert 13.625 from base 10 to base 16. The sign is carried across unchanged; only the magnitude is converted.

Positional expansion of the input — Base 10 to base 16
digitvalueweightweight (base 10)digit x weight
1110^11010
3310^013
6610^-10.10.6
2210^-20.010.02
5510^-30.0010.005
total13.625

Integer part: divide by 16 and read the remainders bottom to top.

Read the last column bottom to top. ↑ — Base 10 to base 16
ndivide byquotientremainder
1313 ÷ 160D

Fraction part: multiply by 16 and read the digits top to bottom.

Read the last column top to bottom. ↓ — Base 10 to base 16
fractionmultiply byproductdigit
0.6250.625 × 1610A

13.625 (base 10)D.A (base 16)

Note:

Notation used on this page

  • Most significant digit first, left to right. A subscript names the base.
  • The prefixes 0b, 0o and 0x are accepted on input and never emitted on output.
  • Digits A–F are case-insensitive on input and upper case on output.
  • A repeating expansion is written with its repetend in parentheses, as 0.0(0011).

Start from a worked example

Which converter do you need?

People search for a binary converter meaning either of the first two; this page does the number one.

Positional notation: what a base actually means

A number written in base b is a sum of its digits multiplied by powers of b: value = Σ dᵢ·bⁱ, where the exponent is the digit’s distance from the radix point — counting up to the left and down to the right. Base b uses the digits 0 to b−1; hexadecimal borrows the letters A to F for the values 10 to 15, because there are no single decimal digits for them.

The four standard bases
BaseDigitsBits per digit
Binary (2)0 11
Octal (8)0–73
Decimal (10)0–9
Hexadecimal (16)0–9 A–F4

Binary to decimal

Write the power of two above each column and add the columns that hold a 1. For 11010110₂: 1×2⁷ + 1×2⁶ + 0×2⁵ + 1×2⁴ + 0×2³ + 1×2² + 1×2¹ + 0×2⁰ = 128 + 64 + 0 + 16 + 0 + 4 + 2 + 0 = 214₁₀. The zero terms are written out rather than skipped: the method is what you are graded on, and a dropped column is where the digits slip.

Decimal to binary

Divide by two repeatedly and keep the remainders: 156 → 78 r0 → 39 r0 → 19 r1 → 9 r1 → 4 r1 → 2 r0 → 1 r0 → 0 r1, giving 10011100₂.

The remainders are read bottom to top — from the last division back to the first. Reading them top to bottom is the single most common error in this conversion, and it produces a number that looks plausible and is wrong.

Binary to hexadecimal, and back

Between base 2, 8 and 16 you do not need division: 8 = 2³ and 16 = 2⁴, so three or four binary digits map to exactly one octal or hexadecimal digit. Group 110111011010₂ into fours from the radix point — 1101 1101 1010 — and read each group as a digit: D, D, A, so DDA₁₆ (3546₁₀). Backwards, 2AF₁₆ expands to 0010 1010 1111 = 1010101111₂ (687₁₀), where the two leading zeros are padding rather than data.

Every four-bit group, in all four bases
BinaryDecimalHexOctal
0000000
0001111
0010222
0011333
0100444
0101555
0110666
0111777
10008810
10019911
101010A12
101111B13
110012C14
110113D15
111014E16
111115F17

Binary to octal, and back

Octal works the same way with groups of three. 11110110111₂ is eleven bits, so the integer side is padded on the left to twelve: 011 110 110 111 → 3, 6, 6, 7 → 3667₈ (1975₁₀). Octal survives in Unix file permissions for exactly this reason: three permission bits are one octal digit.

Decimal to hexadecimal and octal

Repeated division takes any base as its divisor. 1975 ÷ 16 gives 123 r7, then 7 r11, then 0 r7 — and a remainder of 11 is written B, so 1975₁₀ = 7B7₁₆. Dividing the same number by 8 gives 246 r7, 30 r6, 3 r6, 0 r3, so 1975₁₀ = 3667₈, which agrees with the grouping above.

Fractions and the radix point

A fractional part converts by repeated multiplication, and its integer parts are read top to bottom — the opposite direction to the division table. For 0.625: 0.625 × 2 = 1.25 (digit 1), 0.25 × 2 = 0.5 (digit 0), 0.5 × 2 = 1.0 (digit 1), giving .101₂. With the integer part, 13.625₁₀ is 1101.101₂.

Grouping runs outward from the radix point: pad the integer side on the left and the fraction side on the right. 1101.101₂ is D.A₁₆ — the fraction 101 pads right to 1010 = A.

Warning:

Common mistake

Padding the fraction on the left gives the wrong answer. .101₂ is .A₁₆ (pad right to 1010), not .5₁₆, which is what left-padding to 0101 would give.

Non-integers inside a computer are usually not stored this way at all: they use IEEE 754 binary floating point, whose layout is described on the two’s complement page and standardised in IEEE 754-2019 (opens in a new tab).

Repeating expansions

A fraction terminates in base b if and only if, written in lowest terms, every prime factor of the denominator is also a factor of b.

1/10 = 1/(2·5), and 5 does not divide 2, so 0.1 has no terminating binary form: it is 0.0(0011)₂, one non-repeating digit followed by a four-digit repetend. By the same rule 1/3 is 0.(01)₂ with period 2, 1/7 is 0.(001)₂ with period 3, and 1/5 in octal is 0.(1463)₈ with period 4. This is also why 0.1 + 0.2 is not 0.3 in any language that stores numbers in binary floating point.

Signed values

A bit pattern on its own has no sign. 10110110is 182 read as unsigned and −74 read as 8-bit two’s complement. Only the width and the convention you declare decide which.

This page shows the unsigned reading in the four result cards and the signed reading beside them whenever the value is an integer that fits the chosen width. The two’s complement converter shows the complement chain, the range check and sign extension in full.

Large numbers

Every conversion here runs on arbitrary-precision integers and exact rationals, so a value above 2⁵³−1 is exact — which it is not in converters built on double-precision numbers. The demonstration is 2⁶⁴ − 1 = 18446744073709551615 = FFFFFFFFFFFFFFFF₁₆. A tool that answers 18446744073709552000 is telling you about its own arithmetic, not about your number.

Notation used on this page

  • Most significant digit first, left to right; a subscript names the base.
  • The prefixes 0b, 0o and 0x are accepted on input and never emitted on output.
  • Digits A–F are case-insensitive on input and upper case on output.
  • A repeating expansion is marked with an overline on screen and with parentheses in copied text, as 0.0(0011).
  • Fractions are truncated at the digit budget by default rather than rounded. Textbooks differ; state which convention your course expects.

Sources

Positional notation and radix conversion are stated here as definitions rather than attributed to a source. The one external standard this page relies on is IEEE 754-2019, IEEE Standard for Floating-Point Arithmetic (opens in a new tab), cited in the section on fractions.

Worked examples