conversion_decimal_hex
Convert decimal numbers to hexadecimal and back, with signed or unsigned interpretation at 8/16/32/64-bit widths and optional hex formatting. Includes a step-by-step conversion breakdown.
Instructions
Decimal And Hexadecimal Number Converter. Convert one whole number between decimal (base 10) and hexadecimal (base 16) in either direction, with unsigned or signed (two's-complement) interpretation at an 8/16/32/64-bit width and optional hex formatting (0x prefix, upper/lowercase, zero-padding). Use this when you need decimal-hex specifically with a step-by-step breakdown and fixed-width signed handling. Use conversion_binary_decimal for base-2 conversion, conversion_base_converter to convert an integer between arbitrary radixes 2-36, conversion_number_base to map a string of byte values across ASCII/binary/hex/decimal/octal, conversion_hex_ascii to turn hex into ASCII text, and conversion_bcd for binary-coded decimal. Runs locally via the shared logic runner: read-only, non-destructive, offline, no auth, default rate limit (60 requests/minute for anonymous callers). Returns the converted value plus the echoed settings and a per-step conversion breakdown.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| mode | Yes | Conversion direction. | |
| input | Yes | The number to convert. For decimal-to-hex, a whole decimal value with optional sign (e.g. "255" or "-42"). For hex-to-decimal, hex digits 0-9/A-F with an optional 0x prefix (e.g. "FF" or "0x1a"). Leading/trailing whitespace is trimmed; must not be blank. | |
| numberType | No | Interpretation of the value. 'signed' enables two's-complement at the given bitWidth; 'unsigned' treats it as non-negative. | unsigned |
| bitWidth | No | Fixed width for signed (two's-complement) interpretation. Must be one of the enum values when numberType is 'signed'; ignored for unsigned. | |
| hexOptions | No | Optional output formatting for decimal-to-hex (ignored for hex-to-decimal). |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| success | No | True when conversion succeeded; false on validation error. | |
| result | No | The conversion result (present when success is true). | |
| error | No | Error message (present when success is false). |