demo · v140
Uint8Array Base64 / Hex Tool
Type a string. The page encodes it to a Uint8Array and uses the v140 toBase64() / toHex() methods on the prototype to render both encodings. Round-trip back via Uint8Array.fromBase64() / fromHex() to verify.
bytes (decimal)
bytes.toHex()
bytes.toBase64()
round trip (decoded)
const enc = new TextEncoder().encode("hello world");
enc.toBase64(); // "aGVsbG8gd29ybGQ="
enc.toBase64({ alphabet: "base64url" });
enc.toHex(); // "68656c6c6f20776f726c64"
Uint8Array.fromBase64("aGVsbG8=");
Uint8Array.fromHex("68656c6c6f");
see also
- Uint8Array to/from base64 and hex — feature index
- ChromeStatus entry
- TC39 proposal