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.
Live preview
Exactly what your visitors will seeUnder the widget on your page: Powered by A2Z Tools
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.
<div data-a2z-widget="number-base-converter" data-height="510"></div> <script async src="https://a2z.tools/embed.js"></script>
Adds a small script (what it does) that sizes the widget to fit its content, loads it lazily and keeps it isolated from your page's CSS.
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
<a href="https://a2z.tools/number-base-converter">A2Z Tools Number Base Converter</a>
[A2Z Tools Number Base Converter](https://a2z.tools/number-base-converter)
Number Base Converter by A2Z Tools - https://a2z.tools/number-base-converter
Related widgets
-
Numbers 1-3999 to Roman numerals and back, with strict checking and a symbol-by-symbol breakdown.
-
Length, mass, volume, area, temperature, speed, time, data, pressure, energy and power - exact factors.
-
Trig in degrees or radians, logs, roots, powers, factorials, pi, e and Ans - typed or tapped.
-
X% of Y, X as a percent of Y, and the percentage change between two values.
-
A clean on-screen calculator with keyboard support, correct operator precedence and percent.
-
Add, subtract, multiply and divide fractions and mixed numbers, with the simplified answer.