Skip to main content

reverse-hex

Reversing hex can mean three different things: reverse the entire string ("ABCD" β†’ "DCBA"), swap byte order ("12 34 56 78" β†’ "78 56 34 12" β€” endianness conversion), or swap nibbles within each byte ("AB" β†’ "BA"). Each has different uses. The ZTools Reverse Hex tool offers all three modes. Most common use: byte-order swap, when converting between little-endian (Intel) and big-endian (network protocols) representations.

Use cases​

Convert between little-endian and big-endian​

Network protocols use big-endian; x86/ARM use little-endian. A 32-bit value 0x12345678 is stored as 78 56 34 12 in memory but transmitted as 12 34 56 78. Tool swaps in either direction.

Match a checksum / hash​

Some tools display CRC / hash bytes in reverse order. Reverse to match the canonical representation.

Debug endian-confusion bugs​

A C struct serialised differently than expected β€” reverse the bytes to confirm endianness mismatch.

Generate test vectors with reversed input​

Test that your code handles both endiannesses correctly by feeding it both forms.

How it works​

  1. Paste hex β€” With or without spaces / 0x prefixes. Whitespace stripped.
  2. Pick mode β€” Reverse string (full reversal char-by-char), swap bytes (reverse byte order), or swap nibbles (within each byte).
  3. Compute β€” String reversal is straight; byte swap chunks 2 chars at a time; nibble swap flips within each pair.
  4. Output β€” Result hex string in the same format (spaces preserved or removed per input).

Examples​

Input: "12 34 56 78", swap bytes

Output: "78 56 34 12" β€” little-endian β†’ big-endian (or vice versa).


Input: Same input, reverse string

Output: "87 65 43 21" β€” full string reversal, also swaps nibbles within each byte.


Input: "AB CD", swap nibbles

Output: "BA DC" β€” within each byte the high and low nibbles flip.

Frequently asked questions​

Which mode for endianness?

Swap bytes. The byte order changes; the bits within each byte stay the same. This is the typical little-endian ↔ big-endian conversion.

When would I want full string reversal?

Rarely β€” full reversal is mathematically a different operation. Mostly useful for puzzle / curiosity work.

How big a hex string?

Megabytes work fine. The reversal is O(n).

Privacy?

All in browser.

Tips​

  • For endianness, almost always pick "swap bytes" β€” preserves byte values, changes order.
  • For network-order (big-endian) data on x86 (little-endian), htonl / ntohl in C does this; tool does it in browser.
  • Don't confuse with reversing bit order β€” that's a separate operation (use Invert Binary Bits with caution).

Try it now​

The full reverse-hex runs in your browser at https://ztools.zaions.com/reverse-hex β€” no signup, no upload, no data leaves your device.

Open the tool β†—


Last updated: 2026-05-06 Β· Author: Ahsan Mahmood Β· Edit this page on GitHub