Decimal to Little-Endian Hex Converter

Decimal to Little-Endian Hex Converter. Enter your number into Decimal Input and the Decimal to Little-Endian Hex Converter instantly encodes it into Hex Output (little-endian bytes). Use the hex to ip address converter to translate a hex-encoded address from a router log or packet capture into a readable IPv4 format.

Need a number written the way an x86 chip or a microcontroller stores it? The decimal to little-endian hex converter turns a plain base 10 value into hexadecimal and then flips the byte order, so you get the exact byte sequence to write into memory without reversing digits by hand. It suits embedded programming, binary file formats and any job where low-level data has to match a hardware architecture.

How the Decimal to Hex Little Endian Converter Works

The decimal to hex little endian converter follows three steps: it converts your number to ordinary hex, splits that hex into whole bytes, and writes them back with the least significant byte first. You press the Convert button once, and the reversed result appears in the format you picked. Think of it as a hex calculator and a byte reverser fused into one interface, with real-time error handling when an input is invalid. Enter a hex value into the hex to int c# and click Convert to see both the integer result and its C# equivalent.

Entering a Non-Negative Integer

Type a whole, non-negative integer such as 6845231. Because the arithmetic runs on BigInt, a value far beyond 64-bit width still converts without rounding. Fractions and negative signs are rejected, since a plain unsigned integer has no sign bit to carry. If you can only start from a negative decimal to hex job, see the signed section below.

Setting the Byte Length

Leave the byte length blank and you get the smallest number of bytes that holds the value. Enter 2, 4 or 8 to apply byte-length padding, which adds leading zero bytes before the reversal, matching a 16-bit, 32-bit or 64-bit field. If the number needs more room than your forced byte length allows, you see an error instead of a silently truncated answer.

Choosing the Output Format

The output format controls only how the finished result is printed:

  • Bytes prints each one with its prefix, for example 0x2F 0x73 0x68.
  • Concatenated joins them into one string, 2F7368.
  • 0x Concatenated adds a single prefix, 0x2F7368.

Use the copy result button to move the output straight into your editor or hex editor.

Little Endian Hex Formula and Byte Reversal

Every conversion rests on one rule of the base 16 numeral system: a hexadecimal number is a sum of digits multiplied by powers of 16. Divide by 16 repeatedly, collect the remainder from each step, and read them from last to first to get the standard digits.

$$N = \sum_{i=0}^{k} d_{i} \times 16^{i}$$

The little endian format then reorders those digits in pairs, one pair per byte, from the lowest-order pair to the highest-order pair. The characters inside each pair never swap places, which is the mistake people make most often when they reverse a hex string character by character.

Worked Example: Decimal 6845231

Take 6845231. Each row of the table below divides the previous quotient by 16 and records what is left over.

Worked Example: Decimal 6845231
Division by 16QuotientRemainder (decimal)Remainder (hex)
6845231 / 1642782615F
427826 / 162673922
26739 / 16167133
1671 / 1610477
104 / 16688
6 / 16066

Reading from the bottom up gives 68732F, so 684523110 = 68732F16 as an ordinary hex value. Split it into 68, 73 and 2F, reverse the order, and the little endian answer is 2F 73 68.

Now force 4 bytes. The padded hex becomes 0068732F, and the reversed sequence is 2F 73 68 00. The zero moves to the end because the most significant byte now sits last.

6845231 -> 68732F -> 2F 73 68
6845231 (4 bytes) -> 0068732F -> 2F 73 68 00

Decimal to Hex Converter Table: Big Endian vs Little Endian

This decimal to hex converter reference compares how several values look in big endian hex and in the reversed order. A single-byte value never changes, which is why order only matters once a number spans two or more bytes.

Decimal to Hex Converter Table: Big Endian vs Little Endian
DecimalBig endian hexLittle endian bytesSize
200C8C88-bit
1920078080 0716-bit
52966CEE6E6 CE16-bit
684523168732F2F 73 6824-bit
305000417122DEFE1E1 EF 2D 1232-bit

Why Byte Order Matters for Embedded Systems and Binary Protocols

Intel x86 and most ARM configurations store multibyte values with the low byte at the lowest address. Whenever you hand-build a payload for such a device, every number has to arrive in that order. Typical jobs include:

  • Writing a firmware command or a register value for microcontrollers
  • Packing an integer into C/C++ struct packing that mirrors a header
  • Assembling binary payloads for UART, USB, CAN or BLE links
  • Converting offsets while you inspect memory addresses during debugging
  • Decoding a sensor reading that a hardware vendor documents as little endian

The reversed sequence the converter prints is also what you compare against reverse engineering notes, protocol analysis captures and memory dumps, because you recognise a field's real value instead of its stored spelling. Developers and engineers working on a network interface should note that most network protocols send the opposite order, so check each device's documentation before you ship a single byte.

Byte Reversal in Practice: Packing a Sensor Offset for an STM32 Frame

Priya is writing a 4-byte calibration offset into a configuration frame for an STM32 board, whose Cortex-M core runs little endian. The lab's spreadsheet gives the offset as 1847293 counts, and the vendor's frame spec reserves exactly 4 bytes for it.

She enters 1847293 into the decimal to little-endian hex conversion and sets the byte length to 4. The tool returns the plain hex 1C2FFD, pads it to 001C2FFD, and prints the reversed result FD 2F 1C 00 in the Bytes format.

She checks the output against the arithmetic: 28 × 65536 + 47 × 256 + 253 = 1847293, where 28, 47 and 253 are 1C, 2F and FD. The last byte is 00 because the spec reserves 4 bytes and the value only fills 3, which is the same padding the vendor's reference firmware uses.

The result settles a decision. The spec's 32-bit unsigned limit is 4,294,967,295, so 1,847,293 fits with room to spare and she keeps the 4-byte field instead of asking for a wider one. She pastes 0xFD, 0x2F, 0x1C, 0x00 into the frame buffer.

Then she reruns the conversion with the byte length set to 2. The tool reports an error, because 1C2FFD cannot fit in 16 bits. That confirms a 2-byte field would have overflowed, so the 4-byte layout stays.

Hex & Little Endian Converter Checks for Signed Integers

Handling signed integers

This page accepts only non-negative input, matching an unsigned integer field. For a negative value, work out its two's complement for the width you need (flip every bit, then add one) and reverse those bytes the same way. A 16-bit value of -2 is FFFE in standard order and FE FF when stored little endian.

Checking your result with hex to decimal

A reliable accuracy test is a hex to decimal round trip. Reverse the stored bytes, join them, and read the number. If you land on the value you started with, the conversion was accurate.

  1. Write the bytes in stored order: 2F 73 68.
  2. Reverse them: 68 73 2F.
  3. Join and read the hex value: 0x68732F.
  4. Convert to decimal: 6845231.

A binary converter or a hex to binary view helps when you want to see which bits sit in each reversed byte of the converter's output.

Putting the Decimal to Little-Endian Hex Converter Output into Code

Once you have the reversed sequence, the encoding step in software is mechanical. In a C or C/C++ firmware project you paste the values into a buffer and let the compiler place each one at a rising address:

uint8_t frame[4] = { 0x2F, 0x73, 0x68, 0x00 };

Reading that buffer back on a little endian CPU as a single 32-bit integer returns 6845231 again, which is a quick way to prove the stored data matches the original decimal number. In general computing work, such as writing a test fixture or a binary file by hand, the same pattern applies: decide the width first, pad with leading zeros, reverse, and only then copy the values out.

Keep each field's width in a comment beside it. When a later change widens a counter from 3 to 4 bytes, rerun the conversion with the new byte length and it produces fresh data in seconds. Consistent widths also make a conversion table like the one above easy to extend with your own project values.

Common Mistakes When You Use a Hex Converter for Little Endian Output

  • Reversing characters instead of bytes, which scrambles every pair.
  • Forgetting to pad, so a 4-byte field receives only 3.
  • Mixing up the word swap used in Modbus and PLC registers with plain reversal.
  • Assuming 0x belongs inside the stored data, when it is only notation.
Endianness is a storage convention. The converter's output changes only the stored order, never the decimal value you entered.