Reverse Hex

Four reversals live under one name, and they give four different answers on the same input. Pick the one you actually want: byte order for an endian swap, bits inside each byte for serial hardware, nibbles for packed digits, or the raw text.

Reverse the

Hex in

Spaces, dashes, colons, commas, 0x and \x prefixes are stripped before anything runs.

Hex out

Byte order reversed across the whole input

Waiting for input. Paste a memory dump, a packet capture line, or a plain hex string.

0Bytes
0Hex digits
0Groups
0Bytes that moved
Unsigned decimal00
Bytes as ASCII  

Position by position

What sat at each offset before, and what sits there now.

Type some hex and the byte ledger fills in.

Load a case

The same input, five answers

Take the 32-bit value 0x0A0B0C0D and ask five people to reverse it. You get five files back, and only one of them loads.

OperationResultWhere it belongs
Byte order0D0C0B0AEndian swaps between x86 memory and a file or wire format
Bits in each byte50D030B0LSB-first serial links, CRC reflection, some bitmap rows
Nibbles in each byteA0B0C0D0Packed BCD and telecom fields that store digit pairs swapped
Every bit, end to endB030D050Reversing a bit field that crosses byte boundaries
Hex digits as textD0C0B0A0Puzzles and string exercises, almost never binary data

Four of those change the numeric value. One of them, the nibble swap, changes it too. Nothing here is a formatting tweak, so knowing which operation you asked for matters more than the output looking neat.

Byte order is what people mean by endianness

A 32-bit integer holds four bytes. The processor decides which end of memory the low byte sits at, and the two conventions have never agreed.

Write 0x0A0B0C0D to memory on any x86 or ARM machine running little-endian and a hex dump shows 0D 0C 0B 0A. The same value written by a big-endian machine, or by anything following network byte order, reads 0A 0B 0C 0D straight across.

Little-endian
uint32_t v = 0x0A0B0C0D;memory: 0D 0C 0B 0A
Low byte first, what your debugger prints
Big-endian
htonl(0x0A0B0C0D)wire: 0A 0B 0C 0D
High byte first, what the protocol spec shows

So a value that reads backwards in a packet dump usually needs a byte swap, not a digit swap. Set the group size to 4 bytes and the whole buffer flips one word at a time instead of end to end, which is the difference between fixing a header and destroying it.

GUIDs flip only part of themselves

A Microsoft GUID is the sharpest example of a partial swap. The text form 3F2504E0-4F89-11D3-9A0C-0305E82C3301 stores its first three fields little-endian and the last two big-endian, so on disk it reads E0 04 25 3F 89 4F D3 11 9A 0C 03 05 E8 2C 33 01.

Reverse all sixteen bytes and you get a value nothing recognises. The fields have to be swapped at 4, 2, and 2 bytes, with the final eight left alone. Load the GUID sample, work one field at a time, and watch what a whole-input reversal does to it by comparison.

Reversing the digits is not a byte swap

This is the mistake worth naming, because the two operations look similar in a text editor and produce different bytes.

Reversing the characters of 0A0B0C0D gives D0C0B0A0. Reversing the bytes gives 0D0C0B0A. Both are eight hex digits, both look plausible, and only the second one is the little-endian encoding of the original number.

The reason is arithmetic. Reversing the text moves each nibble as if it were an independent unit, so a byte written 0D comes out as D0, which is 208 rather than 13. A text reversal is a byte reversal with a nibble swap glued on top, and that extra step is what breaks the value.

The tell is a leading zero. Bytes below 0x10 are written with one, and a text reversal pushes that zero to the wrong side of the pair every time.

Bit reversal belongs to hardware

Reversing the eight bits inside a byte has nothing to do with endianness. It comes up wherever a wire sends bit 0 of each byte first, ahead of bit 7.

A single byte makes the pattern obvious. 0xA3 is 10100011. Read the bits the other way and you get 11000101, which is 0xC5.

Nibble swaps and packed digits

A nibble is four bits, one hex digit. Swapping the two nibbles in a byte turns 0x12 into 0x21 and leaves the byte count untouched.

The format that needs this is packed BCD, where each nibble holds a decimal digit. Phone numbers in GSM SMS PDUs are stored as semi-octets with the digit pairs swapped, so a number ending in an odd digit gets padded with F. Older smart card and point of sale protocols do the same thing with dates and amounts.

Outside those formats a nibble swap is rarely what you want. If your data looks scrambled inside each byte but the byte sequence seems right, try the nibble swap before assuming the file is corrupt.

Group size changes the answer

Reversal without a boundary treats the input as one long value. That is correct for a single integer and wrong for an array of them.

Take eight bytes holding two 32-bit integers, 0D0C0B0A 1A2B3C4D. Reversed across the whole input, the two integers trade places and each is swapped, which is usually not what you asked for. Reversed in 4 byte groups, each integer flips in place and stays where it belongs.

Whole input
0D0C0B0A1A2B3C4D
4D3C2B1A0A0B0C0D
Order of the two values swapped as well
4 byte groups
0D0C0B0A 1A2B3C4D
0A0B0C0D 4D3C2B1A
Each value flipped in place

When the byte count is not a multiple of the group size, the trailing partial group is reversed within itself and flagged. Real structures do not have ragged tails, so that flag almost always means the input is missing bytes or carries a header the grouping should skip.

An odd number of hex digits is ambiguous

Hex arrives in pairs because a byte is two digits. Paste ABC and there is no way to tell whether you meant the number 0x0ABC or the bytes AB C0.

Padding on the left treats the input as a number, which is right when you copied a value out of a calculator or a register view. Padding on the right treats it as a truncated stream, which is right when you copied from a dump and lost a character. The choice is yours, and the flag stays visible so the padding never happens quietly.

What this page will not do

Checks worth running on the result

Three readouts on this page exist to catch a wrong choice before the bytes go anywhere.

The unsigned decimal pair tells you whether the number you expected appeared. A firmware magic number, a length field, a timestamp near the present day, all of them are recognisable the moment the byte order is right.

The ASCII column is the fastest check on a buffer holding text. File signatures like PK, %PDF, or the ELF tag sitting behind a 0x7F byte show up immediately, and a signature that appears at the tail rather than the head means you reversed something that was already in the right order.

The bytes that moved counter catches the quiet failure. A byte order swap on a single byte, or on a palindrome like 1A2B2B1A, changes nothing at all. Zero movement means either the operation was a no-op or the group size is 1.

Run the result through the tool a second time with the same settings. Every operation here is its own inverse, so you land back on the bytes you started with. The one exception is an odd digit count, where the padding is applied before the reversal, so the round trip returns the padded value rather than the three digits you typed.

Nearby pages

To read a hex value as a number rather than move it around, Hex to Decimal and Hex to Binary do the conversion, and binary is where a bit reversal becomes obvious to the eye. For buffers holding text, Hex to Text decodes the bytes and Text to Hex goes back. When the reversal is part of a bit level fix, Bitwise Calculator and XOR Calculator handle the masking.

Questions that come up with hex in hand

What people ask once real bytes are in the box.

Which option converts little-endian to big-endian?

Byte order, with the group size set to the width of the value. A 32-bit integer needs 4 bytes, a 16-bit field needs 2, a 64-bit timestamp needs 8. Leaving it on whole input works only when the input holds exactly one value, and quietly reorders your data when it holds several.

Why does reversing the digits give a different result?

Because it moves nibbles, not bytes. A byte written 0D comes back as D0, which is 208 instead of 13. Text reversal equals a byte reversal plus a nibble swap in every byte, so it changes the value on top of changing the order. Use it for word puzzles, not for binary data.

My byte count is odd. What happens?

A zero is added, on the left by default. Left padding treats the input as a number, so ABC becomes 0ABC. Right padding treats it as a stream, so ABC becomes ABC0. A flag appears either way, since padding silently is the kind of thing that costs an hour later.

Can I check a reflected CRC polynomial here?

Yes, and it is the fastest sanity check on the bit reversal. Paste 04C11DB7, pick every bit end to end with the group set to whole input, and EDB88320 comes back. Those are the forward and reflected forms of the CRC-32 polynomial used by zlib, gzip, and PNG.

What does the bytes that moved counter mean?

It counts positions where the output byte differs from the input byte at the same offset. Zero means nothing changed, which happens on a single byte, on a palindrome, and whenever a group size of 1 makes the operation a no-op. It is there to catch a setting that did nothing.

Does this handle a hex dump copied from a debugger?

Paste it in. Spaces, colons, dashes, commas, 0x and backslash-x prefixes are stripped before anything runs, so a C array or a Wireshark line works as it is. Offset columns and ASCII gutters do not, because their characters are valid hex and get mixed into the data. Trim those first.

Is the reversal reversible?

Every operation on this page is its own inverse. Run the output through again with identical settings and the original bytes come back, which makes a round trip the best test that you picked the right group size. An odd digit count is the exception, since the zero padding is applied before the reversal and stays in the result.

Does any of this reach a server?

No. The parsing, the reversal, the decimal readout, and the ledger all run in JavaScript inside this tab. Nothing is uploaded and nothing is stored, so closing the page clears whatever you pasted.