Number Base Converter Widget

Add a number base converter to your computer-science or electronics page. Enter a number in binary, octal, decimal, hexadecimal or any base up to 36 and see it in every other base at once, with the two's-complement bit pattern for negatives.

Education & Math Converter Runs in your browser Free · no ads

Customize your widget

Theme
Auto follows the visitor's light/dark setting.
Style
Attribution on your page
Optional and entirely your choice. The exact line is shown in the code below; it links to the tool with rel="nofollow".
More options
Starting values
Leave blank to use the widget's defaults. Visitors can still change every value.

Live preview

Exactly what your visitors will see

Embed code

<iframe src="https://a2z.tools/embed/w/number-base-converter" title="Number Base Converter by A2Z Tools" width="100%" height="510" style="border:0;width:100%" loading="lazy" allow="clipboard-write"></iframe>

A plain iframe. Works everywhere, including site builders that strip scripts. Adjust height if your content needs more room.

Works with

How it works

Like the A2Z Number Base Converter page, the widget does every conversion with arbitrary-precision integers (BigInt), so a 64-bit hex value or a long binary string converts exactly instead of silently losing digits beyond 2^53. Prefixes such as 0x, 0b and 0o are accepted when they match the chosen base, and spaces or underscores used for grouping are ignored. Negative numbers keep their minus sign, and the widget adds the two's-complement pattern at the smallest standard width that fits.

Method

  • Value = sum of digit x base^position (digits 0-9 then a-z for 10-35)
  • Output = repeated division by the target base
  • Two's complement of -n in w bits = 2^w - n, for the smallest w in 8, 16, 32, 64, 128 with n <= 2^(w-1)

Worked examples

A byte value

Inputs: 255 in base 10

Result: Binary 11111111, octal 377, hex FF

255 = 2^8 - 1, so every bit of one byte is set.

Limitations

  • Whole numbers only; fractional parts and IEEE 754 floating-point bit patterns are not converted.
  • Negative values get a two's-complement row only at widths 8, 16, 32, 64 and 128 bits; one's complement, BCD and Gray code are not offered.
  • Input is limited to 1000 digits in the chosen base.

Where publishers use it

  • Computer-science and programming tutorials
  • Embedded-systems and electronics pages that work with registers and bit masks
  • Networking lessons on binary subnet maths
  • Maths classes on positional number systems

Questions

How large a number can it convert?

Up to 1000 digits in the input base, exactly. It uses BigInt, so there is no rounding at 2^53 as with ordinary JavaScript numbers.

How are negative numbers shown?

With a minus sign in every base (sign-magnitude). The two's-complement row shows how a signed integer of the smallest fitting width stores the same value.

Can it convert fractions such as 0.1?

No, it converts whole numbers only. Fractional parts often do not terminate in another base (0.1 in binary repeats forever).

Which letters are used above base 10?

a = 10 up to z = 35, shown in upper case. Input is case-insensitive.

Cite or recommend this tool

If you reference this tool in an article, course or documentation, these formats are ready to copy. They are optional - nothing is added to your site unless you paste it.

A2Z Tools Number Base Converter
https://a2z.tools/number-base-converter

Preview