Uint8Array gains built-in Base64 and Hex methods
The TC39 proposal adding toBase64, fromBase64, toHex and fromHex to Uint8Array reached Stage 4 in July 2025 and is slated for ECMAScript 2026. The methods handle URL-safe base64, padding and strict input validation, and became Baseline 2025 in September 2025.
- toBase64 and fromBase64 replace btoa(String.fromCharCode(...bytes))
- alphabet and omitPadding options cover base64url and padding
- Supported in Chrome 140, Firefox 133, Safari 18.2 and Node.js 25
- Methods are missing in Node 24, so a fallback is needed
Read next
Software