Hex Encoder / Decoder

Turn text or a file into hex, or paste hex back and get the bytes. Copied straight out of a hexdump or a C array is fine — the punctuation is ignored.

Files never leave your device

Options

Hexadecimal writes each byte as two characters from 0 to f, which makes it the format people reach for when they need to look at bytes: a file header, a checksum, a packet capture, the first sixteen bytes of something that will not open. This page converts in both directions, for a pasted string or a whole file, entirely inside your browser.

One byte, two characters

The mapping is direct and positional, with no padding and no state. Each byte splits into two four-bit halves, and each half becomes one character:

ByteHigh halfLow halfHex
00000
100100a
2551515ff

That directness is what makes hex useful for inspection. The tenth byte of a file is always at characters 20 and 21 of its hex, so you can count to a field by eye — something Base64, which packs three bytes into four characters, cannot offer.

Reading hex that came from somewhere else

Hex almost never arrives clean. It comes out of a hexdump with column spacing, out of a C header as a comma-separated array, out of a certificate viewer with colons, or out of a Python repr with backslash-x markers. All of that punctuation is ignored on decode:

  • de ad be ef
  • de:ad:be:ef
  • dead-beef
  • 0xde, 0xad, 0xbe, 0xef
  • \xde\xad\xbe\xef

All five decode to the same four bytes.

Tip: Comparing a downloaded file against a published checksum? Encode the file to hex with no separator and lowercase, then compare against the published value — the two should match character for character.

Writing hex for somewhere else

The output options exist because the destination decides the shape:

DestinationSeparatorPrefixCase
Checksum, config valuenoneofflower
Something a person readsspaceofflower
C or Rust array literalcommaoneither
MAC address, fingerprintcolonoffupper

Size, and why file mode exists

Hex is exactly twice the size of its input — 1 MB in, 2 MB of text out. That doubling is the reason a paste-only tool struggles: a moderately sized file produces a string far larger than a text box can render.

File mode avoids the problem by never building that string in one piece. The file is read as a stream, converted a chunk at a time, and assembled only when you download it. The work happens off the main thread, so the page stays responsive and a progress bar tells you where it is.

Hex or Base64?

Both turn bytes into text. The difference is what you are optimising for:

HexBase64
Size2× the input1.33× the input
Readable byte by byteyesno
Alphabet16 characters64 characters
Typical useinspection, checksums, addressestransport, embedding, tokens

If a person is going to read it, hex. If it is going over a wire or into a field, Base64.

When decoding fails

The tool separates the two ways hex can be wrong. An invalid character means something in the input is not a hex digit and is not punctuation it knows to ignore — the position is reported, and it is usually a letter beyond f that came from surrounding prose. An odd digit count means a digit is missing, which nearly always points at a truncated copy rather than at the data itself.

Frequently asked questions

Is my data uploaded anywhere?
No. The conversion runs inside your browser tab, in JavaScript on your own machine, and no request carries your input off the device. Open your browser's network panel while converting and you will see nothing at all. That matters when the bytes are a firmware image, a key file or a capture from a system you cannot share.
Can it read hex I copied out of a hexdump or a C array?
Yes, and that is the normal case rather than a special one. Spaces, tabs, line breaks, commas, colons and hyphens between bytes are ignored, and the 0x and backslash-x markers that mark a byte in C, Python and shell output are recognised and dropped. Paste what you have and it usually just works.
Why does it say I have an odd number of digits?
Every byte is exactly two hex digits, so a valid run always has an even count. An odd count means one digit is missing — a copy that stopped one character short, a line wrapped in the middle of a byte, or a leading zero dropped by a spreadsheet. The message reports the count so you can find the gap.
Which separator should I choose?
It depends on where the output is going. No separator suits a checksum or a value going into a config field. A single space is the readable form used in most dumps. Comma with the 0x prefix produces something you can paste into a C or Rust array literal. Colon matches how MAC addresses and certificate fingerprints are conventionally written.
Is hex the same as Base64?
They solve the same problem with different trade-offs. Hex uses two characters per byte, so the output is exactly twice the input, and it is easy to read a byte at a time. Base64 uses four characters per three bytes, so it is a third larger than the input rather than double, but it is not readable by eye. Use hex when a human needs to inspect the bytes; use Base64 when size matters.
How large a file can I convert?
File mode reads the file as a stream and converts it in pieces, so the tab keeps responding no matter how large the file is. The practical ceiling is your device's memory, since the finished result is held until you press Download. Text mode is capped at 1 MB, which is a limit on what a text box can render rather than on the converter.
Does uppercase or lowercase matter?
Not to a decoder — this one accepts either, and mixed case in the same string as well. It matters to humans and to string comparisons. Checksums published on release pages are usually lowercase, while certificate fingerprints and MAC addresses are usually uppercase, so match the convention of whatever you are comparing against.