Decimal to Hexadecimal Converter

Convert decimal numbers (integers and floats) to hexadecimal instantly with batch conversion support. Essential tool for programmers, students, and engineers.

Adjust precision for fractional part conversion (higher = more accurate but may create repeating patterns).
Enter a decimal number (integer or float). Positive and negative numbers supported. Scientific notation (e.g., 1.23e-4) also supported.
10
16.5
255
3.14159
0.1
0.5
4096
-15.75
1.23e-4
65535.125

Batch Conversion: Convert multiple decimal numbers at once. Enter one decimal value per line, or separate values with commas, spaces, or tabs. Supports integers and floating-point numbers.

Adjust precision for all fractional part conversions in batch mode.
Enter decimal numbers (integers or floats). Each value will be converted separately. Maximum 1000 values.
Simple List
Basic decimal values for testing
10 16.5 255 4096 65535 1000.25
Comma-Separated
Values separated by commas
10, 16.5, 255, 4096, 65535, 1000.25, 16777215, 4294967295
Common Values
Common decimal values used in programming
1 2 4 8 16 32 64 128 256 512 1024 2048
Converting...

Understanding Hexadecimal Numbers and Floating-Point Conversion

Hexadecimal is a base-16 numeral system that uses digits 0-9 and letters A-F (or a-f). Floating-point numbers in hexadecimal consist of two parts: an integer part and a fractional part separated by a radix point (hexadecimal point).

Floating-Point Conversion Algorithm:

  • Integer Part: Divide by 16 repeatedly, collecting remainders in reverse order (0-9, A-F)
  • Fractional Part: Multiply by 16 repeatedly, collecting integer parts in forward order
  • Negative Numbers: Convert absolute value, then add negative sign
  • Precision: Fractional conversion may require rounding or truncation after specified decimal places

Important Notes on Float Conversion:

  • Some decimal fractions cannot be represented exactly in hexadecimal
  • Increasing precision gives more accurate results but may reveal repeating patterns
  • Scientific notation (e.g., 1.23e-4) is converted to standard decimal first
  • The converter uses double-precision floating-point arithmetic with precision control

Hexadecimal Digits and Values

Hex Digit Decimal Value Binary (4-bit) Hex Digit Decimal Value Binary (4-bit)
0 0 0000 8 8 1000
1 1 0001 9 9 1001
2 2 0010 A 10 1010
3 3 0011 B 11 1011
4 4 0100 C 12 1100
5 5 0101 D 13 1101
6 6 0110 E 14 1110
7 7 0111 F 15 1111

Floating-Point Conversion Examples

1

Decimal 255 to Hex: 255 ÷ 16 = 15 remainder 15 (F), 15 ÷ 16 = 0 remainder 15 (F). So 255₁₀ = FF₁₆

2

Decimal 16.5 to Hex: Integer part 16 = 10₁₆, Fractional part 0.5 × 16 = 8.0 → integer 8, so 16.5₁₀ = 10.8₁₆

3

Decimal 0.1 to Hex: 0.1 × 16 = 1.6 → integer 1, 0.6 × 16 = 9.6 → integer 9, 0.6 × 16 = 9.6 → integer 9 (repeating). So 0.1₁₀ ≈ 0.1999...₁₆ (repeating)

Real-World Applications

  • Computer Programming: Memory addresses, color codes (RGB/HEX), and bitmask operations
  • Web Development: CSS color codes (#RRGGBB), character encoding (Unicode)
  • Digital Electronics: Microcontroller programming, memory dumps, register values
  • Data Representation: Hash values (MD5, SHA), MAC addresses, IPv6 addresses
  • Debugging: Memory inspection, stack traces, and error codes
  • Education: Teaching number system conversion with floating-point numbers

Calculator Features:

  • Converts decimal to hexadecimal with step-by-step calculations
  • Supports integers, floating-point numbers, and negative numbers
  • Adjustable precision for fractional part conversion
  • Supports batch conversion of multiple decimal values
  • Also shows binary and octal equivalents
  • Export results as CSV or JSON
  • Maximum safe integer support: 9,007,199,254,740,991

Frequently Asked Questions

Floating-point numbers are converted in two parts: 1. Integer part: Converted using repeated division by 16 (as with integers) 2. Fractional part: Converted using repeated multiplication by 16. At each step, the integer part of the result becomes the next hexadecimal digit (0-9, A-F), and the fractional part is used for the next multiplication. This continues until the fractional part becomes zero or the desired precision is reached.

Just like some fractions create repeating decimals in base-10 (e.g., 1/3 = 0.333...), some decimal fractions create repeating patterns in base-16. This happens when the decimal fraction cannot be expressed as a finite sum of powers of 1/16. For example, decimal 0.1 becomes approximately 0.199999... in hexadecimal, which repeats. The precision control lets you decide how many digits to calculate.

Hexadecimal numbers are commonly prefixed with: • 0x (used in C, C++, Java, JavaScript, and many other programming languages) • # (used in CSS for color codes) • &H (used in Visual Basic and some older languages) • $ (used in some assembly languages and Pascal) In this converter, we use the 0x prefix for clarity, but you can choose your preferred format when using the results.

Yes, the converter supports scientific notation (e.g., 1.23e-4, 5.67e+8). These values are first converted to standard decimal notation before being converted to hexadecimal. The converter handles very small and very large numbers within the limits of JavaScript's floating-point representation (approximately ±1.8×10³⁰⁸ with about 15 decimal digits of precision).

The batch converter can process up to 1000 values at once. This limit is in place to ensure good performance and prevent browser slowdowns. If you have more values to convert, simply split them into multiple batches of 1000 or fewer values each. Each value in the batch uses the same precision setting for consistency.