Skip to main content

Try it Live

Run Base64 examples in the interactive playground
New to Base64? Start with Fundamentals for guided examples and encoding patterns.

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 all Uint8Array instances:
  • setFromBase64() - Populate from base64 string
  • toBase64() - Encode to base64 string
MDN Reference
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

    Decoding

    Validation

    BrandedBase64

    Tree-shakeable functional API for minimal bundle size. View BrandedBase64 →

    Types

    Base64-encoded string using standard alphabet: A-Z, a-z, 0-9, +, /. Includes padding with = 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:

    Core Documentation

    • 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