Hex Decimal Binary Converter
Convert integers between binary, octal, decimal, hexadecimal, and custom bases up to base 36 with exact BigInt arithmetic.
Use the additional modes to format binary words, inspect two’s complement values, run fixed-width bitwise operations, extract register fields, and convert ASCII or UTF-8 byte sequences.
Engineering tool
Number Base and Bit Converter
Convert integer bases, analyze binary formatting, decode two's complement, perform fixed-width bitwise operations, extract register fields, and inspect character codes.
Integers only. Prefixes 0b, 0o and 0x are supported.
Decimal 255 equals FF in hexadecimal, 377 in octal and 11111111 in binary.
Result console
- Converted Value
- FFbase 16
- Binary
- 11111111base 2
- Octal
- 377base 8
- Decimal
- 255base 10
- Hexadecimal
- FFbase 16
- Digit Count
- 3digits
- Required Bit Length
- 8bits
- Sign
- Positive
- Exact BigInt Value
- 255
| Base | Value |
|---|---|
| Binary | 11111111 |
| Octal | 377 |
| Decimal | 255 |
| Hexadecimal | FF |
| Selected Base 16 | FF |
Formula reference
Base Conversion and Bit Algorithms
The converter handles integer values only and uses BigInt arithmetic to avoid Number precision loss.
value = Σ digit × base^positionoutput digits = repeated division by target base and reading remainderssigned min = -2^(N - 1)signed max = 2^(N - 1) - 1unsigned max = 2^N - 1negative two's complement = 2^N + signed valuemask = 2^N - 1field = (register >> startBit) & ((1 << fieldWidth) - 1)Variable definitions
- N
- selected bit width
- Bit 0
- least significant bit
- A-F
- hexadecimal digits for decimal values 10-15
- Fixed-width bitwise operations apply a mask after shifts and NOT operations
- ASCII is 7-bit, while UTF-8 is a byte encoding for Unicode code points
Worked Examples
255 decimal = FF hex, 11111111 binary, and 377 octal.
DEADBEEF hex = 3735928559 decimal and 11011110101011011011111011101111 binary.
ZZ in base 36 = 1295 decimal.
-1 as 8-bit two's complement = 11111111 binary, FF hex, unsigned 255.
80 hex as 8-bit two's complement = signed -128, unsigned 128.
F0 AND 0F = 00, F0 OR 0F = FF, and F0 XOR 0F = FF in 8-bit logic.
81 hex rotated left by 1 in 8 bits = 03; rotated right by 1 = C0.
Bits 3 through 1 of B6 hex equal binary 011, decimal 3.
Text Hi corresponds to 48 69 hex bytes.
Engineering Notes
- Binary uses base 2, octal uses base 8, decimal uses base 10, and hexadecimal uses base 16.
- One hexadecimal digit represents four binary bits.
- One byte normally contains eight bits.
- BigInt is used to preserve large integer accuracy.
- Two’s complement is the common signed integer representation.
- The same bit pattern can represent different signed and unsigned values.
- Fixed-width bitwise operations require masking.
- Logical right shift fills with zeros while arithmetic right shift preserves the sign bit.
- Rotate operations wrap shifted bits around.
- Bit 0 is the least significant bit.
- ASCII defines 7-bit character codes; byte values 128-255 are not standard ASCII.
- Unicode code points and UTF-8 bytes are different concepts.
Common Mistakes
- Treating hexadecimal digits as decimal text.
- Forgetting that A in hex equals decimal 10.
- Using decimal 10 when binary 10 was intended.
- Ignoring input base prefixes.
- Assuming all large integers are safe JavaScript Numbers.
- Confusing signed and unsigned values.
- Ignoring fixed bit width.
- Using NOT without applying a width mask.
- Confusing logical and arithmetic right shift.
- Forgetting rotate differs from shift.
- Numbering the least significant bit incorrectly.
- Extracting a field with the wrong start bit.
- Treating byte values 128-255 as standard ASCII.
- Confusing Unicode code points with UTF-8 bytes.
- Expecting floating-point conversion from an integer-only tool.
How to Use
- Select a mode based on whether you need conversion, formatting, signed interpretation, bitwise logic, field extraction, or character codes.
- Choose the correct input base. Prefixes such as 0x, 0b, and 0o are recognized, but a conflicting selected base will be reported.
- For signed and bitwise modes, choose the fixed bit width that matches the hardware register, protocol field, or integer type.
- For bit fields, enter the start bit using LSB numbering. Bit 0 is always the least significant bit.
- Review warnings for prefix conflicts, removed separators, truncation, signed/unsigned differences, and non-ASCII characters.
Support reference
FAQ
How do I convert hexadecimal to decimal?
Convert each hexadecimal digit to its numeric value, multiply by 16 raised to the digit position, and sum the results. The calculator performs this with BigInt arithmetic.
How do I convert decimal to binary?
Repeatedly divide the integer by 2 and read the remainders from last to first, or use the converter to generate the exact binary string directly.
What is the difference between binary, octal, decimal and hexadecimal?
Binary uses base 2, octal uses base 8, decimal uses base 10, and hexadecimal uses base 16.
What does 0x mean?
0x is a common prefix indicating that the following digits are hexadecimal.
What does 0b mean?
0b is a common prefix indicating that the following digits are binary.
How many bits are in one hexadecimal digit?
One hexadecimal digit represents exactly four binary bits.
Can this converter handle very large integers?
Yes. Core conversions use BigInt so values beyond JavaScript Number safe integer range remain exact.
Why does the calculator use BigInt?
BigInt prevents precision loss when converting large register values, firmware constants, masks, and protocol fields.
What is two’s complement?
Two’s complement is the common fixed-width signed integer representation used by CPUs and digital logic.
How is -1 represented in 8-bit binary?
-1 in 8-bit two’s complement is 11111111, or FF hexadecimal.
What is the difference between signed and unsigned integers?
The same bit pattern can represent a non-negative unsigned value or a signed value depending on the selected interpretation.
What is the difference between logical and arithmetic right shift?
Logical right shift fills with zeros. Arithmetic right shift preserves the sign bit for signed two’s complement values.
What is a rotate operation?
Rotate moves shifted-out bits back around to the opposite side within a fixed bit width.
How do I extract a register bit field?
Choose the register width, start bit, and field width. Bit 0 is treated as the least significant bit.
Is bit 0 the most significant or least significant bit?
In this calculator, bit 0 is the least significant bit.
What is ASCII?
ASCII is a 7-bit character encoding with values from 0 to 127.
What is the difference between ASCII, Unicode and UTF-8?
ASCII is a 7-bit character set, Unicode defines code points for many scripts, and UTF-8 encodes Unicode code points into bytes.
Can this calculator convert floating-point numbers?
No. This converter supports integer values only.
What is Base 36?
Base 36 uses digits 0-9 and letters A-Z, where Z represents decimal 35.
Why do leading zeros not change the number?
Leading zeros affect display width but do not change the integer value.
Related Calculators
Frequency to Period Converter
AvailableConvert clock and signal frequency to period for timing calculations.
AWG to mm² Converter
AvailableConvert wire gauge, area, diameter, circular mil, and resistance.
dBm to Watt Converter
AvailableConvert RF power, dBW, gain/loss, and cascaded power levels.
LED PWM Dimming Calculator
AvailableCalculate PWM duty cycle, dimming ratio, and LED current behavior.
Converters Category
AvailableBrowse engineering converters for electronics workflows.
Disclaimer
This converter provides integer, bit-level, and character-code analysis for engineering reference. Verify hardware register definitions, compiler behavior, CPU instruction semantics, protocol specifications, and firmware test cases before production use.
