Format Code Now
/

Hex to Base64 Converter

ED-20

Paste hex bytes to get Base64. Spaces, colons, commas, dashes and 0x prefixes between bytes are ignored, and you can choose the standard or the URL-safe alphabet.

Runs in your browser. Nothing is uploaded.

Hex bytes

Base64

How to use it

  1. Paste your hex into the input box, for example 48 65 6c 6c 6f or 0x48 0x65.
  2. Choose the standard (+ and /) or URL-safe (- and _) alphabet.
  3. Leave Add = padding ticked for standard Base64, or untick it for the bare form.
  4. Click Convert to Base64, then copy the result or download it as a .txt file.

What hex input it reads

The tool reads pairs of hex digits, in upper or lower case. Between bytes you can use spaces, line breaks, colons, commas or dashes, which covers a fingerprint like AA:BB:CC and a dump copied from a debugger. A 0x at the start of a group is removed. It does not understand the \x form or other separators, and it tells you the line and column of the first character it cannot read.

Standard versus URL-safe output

Standard Base64 uses + and /, which have special meanings in URLs and file names. The URL-safe alphabet swaps them for - and _. It is the form JWTs use, usually without the trailing = padding. Pick the alphabet your target expects, and use the padding box to add or leave out the = characters. The output is one unbroken line with no line wrapping.

Odd digit counts

A byte needs two hex digits, so an odd number of digits is an error rather than something the tool guesses at. It does not add a leading zero for you, because that would change which bytes you get. If you meant 0a, write 0a. The empty input gives an empty result.

Error messages and what to do

MessageWhat it meansFix
Invalid hex characterThe input holds a character that is not 0 to 9 or a to f and is not an allowed separator.Fix the character at the position shown, or strip other text such as labels.
The hex has an odd number of digitsHex needs two digits per byte, so the digit count must be even.Add the missing digit, usually a leading zero.

Questions people ask

How do I convert hex to Base64?

Paste the hex into the box and click Convert to Base64. Each pair of hex digits becomes one byte, and the bytes are written in Base64. For example 48656c6c6f becomes SGVsbG8=. You can keep spaces or colons in the input.

Can I paste hex with 0x in front of each byte?

Yes. A 0x at the start of a group is dropped, so 0x48 0x65 0x6c works, and so does 0x48656c. The prefix only counts at the start of the input or right after a separator.

How do I get URL-safe Base64 from hex?

Choose URL-safe (- and _) under Alphabet. The tool then writes - and _ in place of + and /. Untick Add = padding as well if the system you are sending it to expects Base64URL without padding.

Why does the tool reject an odd number of hex digits?

Two hex digits make one byte, so a leftover digit is half a byte. Guessing the missing half could silently change your data, so the tool stops and tells you. Add the missing digit and convert again.

Does it wrap the Base64 output at 76 characters?

No. The result is one line with no breaks. If you need MIME style wrapping, add the line breaks yourself afterwards, because the tool does not do it.

Is my hex uploaded?

No. The conversion runs entirely in your browser, so the bytes you paste are not sent to a server or stored anywhere. There is no sign-up, and the page works the same way with your network turned off once it has loaded.

About this tool

Reads pairs of hex digits. Spaces, line breaks, colons, commas and dashes between bytes are ignored, and 0x in front of a group is dropped. It does not know about other separators or the \x form. An odd number of digits or any other character is an error that names the position. The output is plain Base64 of the bytes with no line wrapping. Standard output uses + and /; URL-safe uses - and _. Padding with = is on by default and can be turned off.

Format Code Now: free, no ads, no accounts. Your input stays in your browser.