Skip to content
Free Calculator logoFree Calculator

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

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

In short

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

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ᴺ⁻¹.

Press Calculate, or Enter in any field.

−42 in 8-bit two's complement

Binary −101010, hex −2A, 8-bit pattern 11010110.

Enter a number to convert.

What this calculator does

Convert whole numbers between binary, octal, decimal and hexadecimal with two's-complement bit patterns. Formula, worked example, sources, FAQs and limitations included.

You enter number to convert, input base and two's-complement width, and the number base converter (binary, octal, decimal, hex) shows the answer along with the working, so you can check it or try other numbers.

The page shows the formula, a numeric worked example, and the assumptions that affect this developer tools calculation.

Inputs and what they mean

Number to convert
— text value.
Input base
— choice value.
Two's-complement width
— choice value.

How to use it

  1. Enter each value in the unit shown next to the box (use the unit converter first if your numbers are in other units).
  2. Check the breakdown to see every intermediate step.
  3. Read the limitations before relying on the result.

Formula

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.

Worked example

−42 in 8-bit two's complement

  1. 42 = 101010₂.
  2. 2⁸ − 42 = 214 = 11010110₂.

Reading the result

The headline figure is the main answer. Any breakdown underneath shows the parts that make it up, so you can check the working and see what changes when you adjust an input.

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.

Reference: Cornell University

Last reviewed:

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.

Sources

Method based on Cornell University.

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

Related tools

Format JSON into clean, readable indentation locally.

Developer Tools

Check JSON syntax and see clear parsing errors locally.

Developer Tools

Remove optional whitespace from valid JSON.

Developer Tools

Encode Unicode text as standard Base64.

Developer Tools

Decode valid Base64 into Unicode text.

Developer Tools

Percent-encode text for use in a URL component.

Developer Tools