# Number Base Converter (Binary, Octal, Decimal, Hex)

> Convert whole numbers between binary, octal, decimal and hexadecimal with two's-complement bit patterns.

Page: https://freecalculator.tech/tools/number-base-converter
Last reviewed: 2026-11-03

## Formula

value = Σ dᵢ × baseⁱ. Two's complement of a negative v in N bits is the unsigned pattern 2ᴺ + v; a non-negative v fits when v < 2ᴺ⁻¹.

- Sources: Cornell University CS notes on two's complement; positional notation.
- Arbitrary-precision integers (up to 128 input digits) — no floating-point rounding.
- value = Σ dᵢ × baseⁱ. Two's complement of a negative v in N bits is the unsigned pattern 2ᴺ + v; a non-negative v fits when v < 2ᴺ⁻¹.
- Inputs used: Number to convert, Input base, Two's-complement width.

## Inputs

- Number to convert
- Input base
- Two's-complement width

## Worked example: −42 in 8-bit two's complement

Binary −101010, hex −2A, 8-bit pattern 11010110.
1. 42 = 101010₂.
2. 2⁸ − 42 = 214 = 11010110₂.

## Common questions

### Can I enter 0x or 0b prefixes?

Yes. Prefixes matching the selected base are accepted, and spaces or underscores are ignored.

### What is two's complement?

The standard way computers store signed integers: a negative number is stored as 2ᴺ plus the value.

### Are fractions supported?

No. Only whole numbers are converted, so every result is exact.

### How do I use the Number Base Converter (Binary, Octal, Decimal, Hex)?

Enter the required values for Number to convert, Input base, Two's-complement width. The calculator applies the formula on this page and shows the main result with any supporting breakdown so you can check the arithmetic.

### What formula does the Number Base Converter (Binary, Octal, Decimal, Hex) use?

value = Σ dᵢ × baseⁱ. Two's complement of a negative v in N bits is the unsigned pattern 2ᴺ + v; a non-negative v fits when v < 2ᴺ⁻¹. The visible formula section above lists the calculation path and the edge cases the page handles, so the result can be checked without relying on the form alone.

### Can the Number Base Converter (Binary, Octal, Decimal, Hex) be used for exact decisions?

Use it as a calculation aid, not as a substitute for checking the underlying rule, contract, policy, or professional advice that applies to your situation. When a result depends on local rules, personal details, prices, or dates, enter those values yourself and confirm them before acting.

## Limitations and assumptions

- Integers only; no fractional or floating-point formats (IEEE 754).
- Two's-complement row shows 'does not fit' when the value is outside the signed N-bit range.
- Runs entirely in your browser. Conversions are exact for the stated encoding and bit width.
- The result depends on the values you enter for this number base converter (binary, octal, decimal, hex); it does not supply missing rates, rules, prices, dates, or assumptions for you.

## Sources

- Cornell University — https://www.cs.cornell.edu/~tomf/notes/cps104/twoscomp.html

## Cite this page

- APA: Free Calculator. (2026, November 3). Number Base Converter (Binary, Octal, Decimal, Hex). https://freecalculator.tech/tools/number-base-converter
- MLA: "Number Base Converter (Binary, Octal, Decimal, Hex)." Free Calculator, 3 Nov. 2026, https://freecalculator.tech/tools/number-base-converter.
- Link: Number Base Converter (Binary, Octal, Decimal, Hex) — Free Calculator, https://freecalculator.tech/tools/number-base-converter
