0b111111110o3772550xFF7V73About Integer Base Converter
Converting between number bases is basic literacy for debugging binary protocols, reading memory dumps, understanding permission bitmasks and handling colour values. The same number shows which bits are set in binary, becomes four times shorter in hexadecimal for easy mental arithmetic, only feels intuitive in decimal, and octal still appears in file permissions and some legacy systems. The mechanism works in two directions: weighted expansion to convert any base into decimal, and repeated division with remainders read in reverse to convert decimal into a target base. Understanding both explains why hexadecimal and binary map four digits to one directly, and why octal aligns to three bits for permissions. Practical notes: Prefer the binary view for bit operations and masks, where you can see at a glance which bit is which switch, and use hexadecimal for byte streams and memory addresses, since two hex digits are exactly one byte. On validation, confirm that invalid digits are rejected, such as a 2 in binary or an 8 in octal; silent truncation instead of an error offsets every downstream calculation. Negative numbers need an explicit representation as well, because bitwise operations use fixed-width two's complement and the same negative value looks entirely different in 8 and 32 bits. Limits: Integer precision underlies every base conversion, so values beyond the safe integer range must use a big-number type or the last digits come out wrong, the same root cause as the JSON precision issue. Floating-point conversion between bases is inexact by nature, since binary representation of decimal fractions is approximate, so a decimal fraction shows a long tail in binary; engineering practice fixes the number of retained digits and compares with a tolerance. Distinguish base from encoding too: interpreting a run of hex characters as text is an encoding problem requiring a further character-set decode on the bytes, and conflating the two steps produces output that looks like mojibake. Data and privacy: base conversion commonly handles key material, hash digests and protocol payloads, all of which are sensitive. This tool computes everything in the browser, uploads nothing and works offline; for keys and payloads, operate in an offline environment. Combined with bitwise operations there is a set of concepts worth mastering: masks take specific bits with AND, set them with OR, clear them with AND NOT, and toggle them with XOR. All of it depends on intuition for the binary form, so when debugging permission bits, status flags or protocol header fields, looking at the bit layout first is much faster than trial and error. Exchanging binary data across systems also requires agreeing on endianness: the same hex string means entirely different numbers under little and big endian, and if the protocol document omits it, integration shows up as "the values differ by a huge factor", which is simply the byte order reversed. Stating endianness and bit width prominently in the protocol document saves the most time-consuming round of integration debugging.
How It Works Internally
Conversion runs in two directions: any base to decimal by weighting each digit, and decimal to a target base by repeated division with remainders read in reverse. These two steps show why hexadecimal maps four binary digits to one and octal three to one. Digit count sets capacity: n binary digits represent at most two to the power of n values.
255binary 11111111 | octal 377 | hex FF (three binary digits equal one octal digit)Measured on This Page
| Conventional cases | 255, 1010₂, ffffffff₁₆ and z₃₆ all agree with int() |
|---|---|
| Fixed here | parseInt goes through doubles and silently loses precision above 2^53: sixty-four 1-bits (2^64−1) produced hexadecimal 0x10000000000000000 |
| How | Digits are folded into a BigInt by hand, so precision no longer depends on double range — the 64-bit input now yields 0xFFFFFFFFFFFFFFFF |
| 2^53+1 | 9007199254740993 correctly shows 0x20000000000001; the old build would have rounded to 9007199254740992 |
| Invalid input | Characters outside the base (and a minus sign) hide the result and report invalid-for-base |
2^53 (about 9×10^15) is where IEEE 754 doubles run out of integer precision, and it is exactly where many language tools break large-number base conversion. This page now uses BigInt end to end and stays exact for any length — but as an unsigned non-negative integer, so negative and fractional input needs sign handling elsewhere.
How to Use
- Open "Integer Base Converter"
- Type the integer into the input field
- Tap the source-base button
- Each result card shows binary, octal, hex and more
- Click the copy icon beside a value
Use Cases
- Read registers — Convert a hex register value to binary to inspect each flag bit.
- Decode permissions — Turn Linux octal 755 into bits to check read/write/execute settings.
- Color debugging — Convert hex color components to decimal to compare with RGB values.
- Protocol decoding — Convert captured hex bytes to decimal to match protocol field meanings.
- Practice problems — Quickly verify base-conversion answers while studying or drilling.
- IP address math — Convert between dotted-decimal IPv4 and 32-bit integer for subnet calculations or CIDR range comparisons.
- Memory address debugging — Translate hex memory addresses from crash dumps or debugger output to decimal for offset calculations.
FAQ
Which base range is supported?
Any conversion between base 2 and base 36. Bases above 10 use letters a-z, so hex uses a-f and base 36 can use up to z.
Can it handle very large numbers?
Yes. It uses big-integer arithmetic with no 32/64-bit limit, so numbers dozens of digits long convert exactly without losing precision.
Are decimals or negatives supported?
It targets integers. A leading minus is usually recognized, but cross-base fractional conversion is limited by representation, so use it for integers.
What if I include spaces or a prefix?
Common 0x/0b prefixes and surrounding spaces are generally tolerated, but characters outside the chosen base raise an error — check you picked the right source base.
How does this differ from the color converter?
This does pure numeric base conversion only. To convert between HEX, RGB, and HSL color formats, use our color format converter.
How do I convert between decimal, binary, octal, and hex?
All four bases share a single input box. Type the number, pick its source base and your target base, and the result updates live — no manual base-by-base division is required, so you avoid arithmetic mistakes. For example, enter 255 in decimal and you see hex FF, octal 377, and binary 11111111 at once. If you need to step through intermediate bases, copy a result back into the same field and repeat; the computation stays local, so large values are handled exactly.
How do I convert binary to hex online?
Set the source base to 2 (binary) and the target base to 16 (hex) in this tool, paste the binary string, and the hex value appears immediately. Because everything is computed in your browser, nothing is uploaded — handy when the value is an internal key, address, or register. The same form also converts to octal or decimal, and supports any base from 2 to 36 if you need yet another representation, with exact big-integer math for very long inputs.
Leading zeros disappear when converting binary?
Numeric conversion works on values, and leading zeros carry no information so they are dropped. If the width is meaningful (fixed-length device IDs, register bit width), zero-pad as text or use a fixed-width output option.