demo ยท v138
Uint8Array.{from,to}{Base64,Hex}
Native conversion between byte arrays and base64/hex strings. Type text, paste a hex string, paste base64 โ round-trip whichever way you came in.
checking support…
base64 alphabet
Edit any field โ the others update.
the code
const bytes = new TextEncoder().encode("Hello!");
const b64 = bytes.toBase64(); // "SGVsbG8h"
const hex = bytes.toHex(); // "48656c6c6f21"
const back = Uint8Array.fromBase64(b64); // Uint8Array(6) [...]
const text = new TextDecoder().decode(back); // "Hello!"
bytes.toBase64({ alphabet: "base64url" }); // URL-safe variant
see also
- Uint8Array base64/hex helpers โ feature index
- ChromeStatus entry
- TC39 proposal