Convert a WPA PSK from hex to ASCII

When hex-to-ASCII conversion recovers a Wi-Fi passphrase, when it cannot, and how to check and handle the result safely.

A hex string labelled as a Wi-Fi key can be one of two different things. It may be a passphrase that has been hex-encoded for storage or display, or it may be the 256-bit pre-shared key that WPA and WPA2-Personal derive from the passphrase. Converting hex to ASCII only recovers a usable passphrase in the first case. This review explains how to tell them apart, what the conversion changes, and how to handle the result without breaking it or exposing it.

Is the conversion suitable for your purpose?

Use it when you have a hex string that encodes the passphrase itself and you need a form that people can type or that a device asks for as a password. In that case the main benefit is that the result can be read aloud, typed on a phone, or entered in any setup screen that only accepts a passphrase. The main limitation is that the conversion is useless on a raw 64-digit PSK. A raw PSK is not encoded text. Decoding it gives arbitrary bytes, not the original password. Keep the hex form if the destination accepts a raw 64-hex-digit key and nobody needs to type it. Keep the original passphrase if you already have it.

What the conversion actually changes

Hex-to-ASCII decoding changes the stored characters. It does not change how they look. It reads the hex digits in pairs, left to right. Each pair becomes one byte, and each byte is then interpreted as an ASCII character. Hex digits are case-insensitive, so 6F and 6f decode to the same byte. The decoded text is case-sensitive, and so is the passphrase. Nothing is reversed, mirrored, or restyled. No font, Unicode lookalike substitution, CSS, or bidirectional display is involved. Words like reverse or mirror only apply here if a tool has mistakenly swapped byte order. Standard decoding keeps the pairs in their original sequence.

Hex:   63 6f 72 72 65 63 74 20 68 6f 72 73 65
ASCII: c  o  r  r  e  c  t  ␠  h  o  r  s  e

Result: "correct horse"  (13 characters, including one space)

The example contains only single-byte ASCII characters, so there are no combining marks or multi-code-point emoji. Under the WPA2-Personal rules for passphrases, there shouldn't be any. The standard defines a passphrase as 8 to 63 printable ASCII characters, from code 32 (space) through 126 (tilde). If a decoded result contains bytes outside that range, it is not a standard WPA2 passphrase.

Two kinds of hex you might be holding

Form | Typical length | What decoding gives
Hex-encoded passphrase | 16 to 126 hex digits (two per character) | The readable passphrase
Raw WPA/WPA2 PSK | Exactly 64 hex digits | Mostly non-printable bytes; not the passphrase

The raw PSK comes from running the passphrase and the network name (SSID) through PBKDF2 with HMAC-SHA1, using 4,096 iterations and a 32-byte output. That derivation is one-way. No hex-to-ASCII step, or any other simple conversion, turns it back into the passphrase. One length is ambiguous: a 32-character passphrase, hex-encoded, is also 64 digits long. Configuration context can settle it. For example, wpa_supplicant treats a quoted psk value as a passphrase and an unquoted 64-hex-digit value as a raw key. Windows wireless profiles also distinguish a passPhrase key type from a networkKey type. Without such context, decode the string and check the result.

Checking a decoded result

  • The hex has an even number of digits and contains only 0–9 and a–f (either case).
  • The decoded length is between 8 and 63 characters.
  • Every byte is in the printable ASCII range 0x20–0x7E.
  • The result looks like something a person chose, not random punctuation. This is a weak signal on its own, since random passphrases exist too.
  • If possible, confirm by joining the network or by recomputing the PSK from the decoded passphrase and the SSID and comparing it with a known raw key.

The following local Python sketch applies the first three checks. It reads the hex without echoing it to the screen or writing it to shell history. It prints the result with quotes so that leading and trailing spaces stay visible.

import getpass

h = getpass.getpass("Hex: ").strip()
b = bytes.fromhex(h)
if 8 <= len(b) <= 63 and all(0x20 <= c <= 0x7E for c in b):
    print("Likely passphrase:", repr(b.decode("ascii")))
else:
    print("Not a valid WPA2 passphrase; possibly a raw 256-bit PSK")

The wpa_passphrase utility that ships with wpa_supplicant takes an SSID and a passphrase and prints the derived 64-digit PSK. That makes it a way to do the recompute-and-compare check without sending the secret anywhere.

Readability and usability after copying or sharing

Spaces count in a passphrase, so watch for them. Leading or trailing spaces can be lost when the text is pasted into a form, message, or note that trims whitespace. A single missing space makes the key fail without any visible sign. A doubled internal space can also collapse in some editors or chat tools. Check the character count after pasting.

Some decoded passphrases contain characters that are easy to confuse, such as l, I, and 1, or O and 0. A screen reader may announce symbols inconsistently or skip some at certain verbosity settings, and the string may be hard to follow when spoken. If the key will be read aloud or entered with assistive technology, give a character-by-character version that names each symbol and states the case of each letter. No specific screen reader or messaging app was tested for this review.

Decoding does not affect search or editing beyond producing ordinary text. Editing the result by hand does change the key. When pasting into a configuration file, quotes, backslashes, and other delimiters may need escaping according to that format's rules. In that case the text in the file is not identical to the passphrase you type on a device.

Handling the key safely

A Wi-Fi passphrase or PSK is a credential. Hex decoding is simple enough to do locally with a command-line tool or a short script, so there is little reason to paste the key into a web converter. Don't rely on a website's design or wording as evidence of how it handles or retains what you submit. If you decode on the command line, prefer an input method that keeps the key out of shell history. Clear the output from shared screens or terminals afterwards.

When plain text or raw hex is the better choice

Plain-text passphrases are better for people: guests, setup screens on phones and consumer devices, and anywhere the key is typed or spoken. The raw 64-digit PSK is fine for machine-to-machine configuration where the format accepts it, and it avoids exposing the passphrase itself. It is still tied to the SSID and still grants network access. WPA3-Personal (SAE) uses the password directly rather than this precomputed PSK, so a raw WPA2 hex key generally does not substitute for a WPA3 password.

Gaps in this review

This review did not examine or test particular routers, backup files, or vendor tools. It cannot say which ones store the passphrase as hex, which store the raw PSK, or how they label each. Behaviour of specific messaging apps, password managers, and screen readers when handling these strings was also not tested. The format descriptions above follow the WPA2 passphrase rules and the documented behaviour of wpa_supplicant and Windows wireless profiles. Check any other destination's own documentation.