Documentation Index
Fetch the complete documentation index at: https://voltaire.tevm.sh/llms.txt
Use this file to discover all available pages before exploring further.
Try it Live
Run Base64 examples in the interactive playground
Type Definition
Namespace providing standard (RFC 4648) and URL-safe base64 encoding/decoding. Built on Web APIs (btoa/atob) for maximum performance and compatibility. Zero-overhead design with tree-shakeable function exports.
Web API Integration
JavaScript builtins available on allUint8Array instances:
setFromBase64()- Populate from base64 stringtoBase64()- Encode to base64 string
toBase64() and setFromBase64() are available as of 2025 (Node.js 22+, Chrome 131+). Use Tevm’s Base64.encode() for broader compatibility.Quick Reference
Effect Schema
API Methods
Encoding
encode(data)- Encode bytes to standard base64encodeString(str)- Encode UTF-8 string to base64encodeUrlSafe(data)- Encode bytes to URL-safe base64encodeStringUrlSafe(str)- Encode string to URL-safe base64calcEncodedSize(length)- Calculate encoded size
Decoding
decode(encoded)- Decode standard base64 to bytesdecodeToString(encoded)- Decode base64 to UTF-8 stringdecodeUrlSafe(encoded)- Decode URL-safe base64 to bytesdecodeUrlSafeToString(encoded)- Decode URL-safe base64 to stringcalcDecodedSize(length)- Calculate decoded size
Validation
isValid(str)- Validate standard base64 formatisValidUrlSafe(str)- Validate URL-safe base64 format
BrandedBase64
Tree-shakeable functional API for minimal bundle size. View BrandedBase64 →Types
- Base64String
- Base64UrlString
= characters.Usage Patterns
Encoding Binary Data
Encoding Strings
URL-Safe Encoding
Safe Decoding with Validation
Pre-allocating Buffers
Tree-Shaking
Import only what you need for optimal bundle size:Related
Core Documentation
- Fundamentals - Learn encoding algorithm and patterns
- Encoding - Encoding methods and variants
- Decoding - Decoding methods and error handling
- Validation - Format validation patterns
Related Primitives
- Hex - Hex string encoding and decoding
- Keccak256 - Keccak256 hashing for data integrity
- Uint - Unsigned integer utilities
Specification
- RFC 4648 - Base64 encoding specification
- Section 4: Standard base64 encoding
- Section 5: URL-safe base64 encoding
- MDN Web APIs - Browser base64 APIs

