base64

Correct, fast, and configurable base64 encoding and decoding for Rust, with pluggable alphabets and padding.

Library
Cargo
v0.23.1
735stars
Apache License 2.0

Repository Health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum.How we score it →
68/100Good
Development Activity76
Maintenance40
Community68
Maturity60
Momentum28

Technical Analysis

AI-assessed by reading the actual repository — architecture, code quality, innovation, and documentation.How we score it →
85/100Excellent
Architecture85
Code Quality90
Innovation80
Learning Curve85

base64 is the de facto standard Rust crate for encoding and decoding base64 data, downloaded well over a billion times from crates.io. It exposes an Engine trait so applications can choose the alphabet (standard, URL-safe, or a fully custom one) and padding behavior (canonical, no-pad, or custom padding modes) that fit their protocol, while keeping a single consistent API surface.

The crate targets both convenience and raw throughput: high-level encode/decode methods allocate a String or Vec<u8> for you, while slice- and Vec-based variants let performance-sensitive code avoid extra allocations entirely. It also ships streaming Read/Write adapters and a Display wrapper, is no_std-compatible, and forbids unsafe code throughout, making it a safe default for any Rust codebase that needs to move binary data through text-only channels.

What You Get

  • A pluggable Engine trait with a ready-to-use GeneralPurpose implementation and pre-configured STANDARD, STANDARD_NO_PAD, URL_SAFE, and URL_SAFE_NO_PAD engines
  • Multiple encode/decode entry points — allocating (String/Vec<u8>), in-place (append to an existing String/Vec), and zero-allocation slice variants — so you can trade convenience for throughput as needed
  • Streaming DecoderReader and EncoderWriter adapters for std::io::Read/Write, plus a Base64Display wrapper for formatting without allocating
  • no_std and alloc-only build support via Cargo features, with #![forbid(unsafe_code)] guaranteeing memory safety throughout

Common Use Cases

  • Encoding binary payloads (images, keys, tokens) into JSON, XML, or other text-only API responses
  • Decoding Basic Auth headers, JWT segments, and other base64-encoded HTTP artifacts
  • Embedding binary assets or hashes as base64 strings in config files, URLs, or data URIs
  • Streaming large files through base64 encoding/decoding without buffering the whole payload in memory

Under The Hood

Architecture — The crate centers on an Engine trait (src/engine/mod.rs) that separates the public encode/decode API from the low-level byte-shuffling implementation. GeneralPurpose (src/engine/general_purpose/) is the only shipped implementation today, parameterized by an Alphabet (src/alphabet.rs) and a GeneralPurposeConfig controlling padding behavior; pre-built STANDARD, STANDARD_NO_PAD, URL_SAFE, and URL_SAFE_NO_PAD constants cover the common RFC 4648 cases. Encoding and decoding logic live in dedicated src/encode.rs and src/decode.rs modules, with src/read/decoder.rs and src/write/encoder.rs layering std::io::Read/Write adapters on top of the same engine calls, so streaming and in-memory paths share one correctness-critical core.

Tech Stack — Pure Rust with the 2018 edition and an MSRV of 1.48.0, no runtime dependencies; dev-dependencies (criterion, rand, clap, strum, rstest) are test/benchmark-only. Cargo features (std, alloc, default std) gate std::io support and heap allocation independently, allowing no_std embedded builds when only alloc (or neither) is enabled.

Code Quality — The crate enforces #![forbid(unsafe_code)] and #![deny(missing_docs, ...)] at the crate root, and carries a large first-party test suite (85+ #[test] functions across src/engine/tests.rs, src/read/decoder_tests.rs, src/write/encoder_tests.rs, and tests/), plus fuzz targets under fuzz/ (roundtrip, roundtrip_no_pad, decode_random) run via cargo-fuzz. Naming is consistent (encode/encode_string/encode_slice mirrored by decode/decode_vec/decode_slice), and error types (DecodeError, DecodeSliceError, EncodeSliceError) are explicit enums rather than opaque strings.

API Design — The Engine trait plus a prelude module give both an explicit, discoverable API (use base64::{engine::general_purpose::STANDARD, Engine as _}) and a minimal-footprint shortcut (use base64::prelude::*). A documented table in the crate-level docs maps each use case (allocate vs. append vs. write-into-buffer) to the right method, and every documented example is a runnable doctest, which keeps the extensive documentation verified against the actual API on every cargo test run.

Used by 57 apps in this directory

Rust
65%
Apache 2.0

agentgateway

AI Development · Developer Tools

4,739

An open source AI-native proxy that secures, observes, and governs agent-to-LLM, agent-to-tool, and agent-to-agent communication through MCP, A2A, and unified LLM routing.

View details
88
Repo Health
82
Technical
70
Dependency
Built with
Rust65%
Go23%
Updated yesterday
Dart
74%
AGPL 3.0

AppFlowy

Productivity · Project Management · Collaboration

76,354

The open-source AI workspace that puts your data, your rules — with local LLMs, CRDT collaboration, and full self-hosting built in.

View details
67
Repo Health
81
Technical
67
Dependency
Built with
Dart74%
Rust24%
Updated 6 days ago
C#
84%
Other

Bitwarden Server

Password Manager · Security

20,048

Self-hosted, open-source password management backend with zero-knowledge encryption and enterprise-grade identity services

View details
92
Repo Health
82
Technical
78
Dependency
Built with
C#84%
Updated 3 days ago
TypeScript
79%
GPL 3.0

Bramble

Password Manager · Security · Authentication

381

Local-first, end-to-end encrypted password manager that syncs your vault directly between your own devices over a private peer-to-peer mesh — no server, no account, no cloud in the middle.

View details
75
Repo Health
84
Technical
72
Dependency
Built with
TypeScript79%
Updated 3 days ago
Rust
53%
Other

Cap

Team Chat · Video Conferencing

21,859

Open source Loom alternative with GPU-accelerated recording, instant share links, AI summaries, and full self-hosting via Docker Compose.

View details
89
Repo Health
81
Technical
64
Dependency
Built with
Rust53%
TypeScript43%
Updated yesterday
Swift
64%
GPL 3.0

cmux

Developer Tools · AI Development

26,845

A native, Ghostty-based macOS terminal with vertical tabs, agent-aware notifications, and a scriptable browser built for running many parallel AI coding agent sessions instead of juggling tmux panes.

View details
84
Repo Health
81
Technical
72
Dependency
Built with
Swift64%
Rust14%
Updated today
Rust
52%
Apache 2.0

cocoindex

Data Engineering · AI Development

11,496

An incremental data indexing engine that keeps AI agent context perpetually fresh by reprocessing only what changed.

View details
86
Repo Health
85
Technical
64
Dependency
Built with
Rust52%
Python48%
Updated 2 days ago
Go
59%
Apache 2.0

Cog

AI Development · Devops · Developer Tools

9,468

An open-source CLI that packages machine learning models into standard, production-ready Docker containers — no Dockerfile wrangling, no CUDA version hell.

View details
89
Repo Health
88
Technical
69
Dependency
Built with
Go59%
Rust17%
HTML13%
Updated 5 days ago
Go
32%
Apache 2.0

CubeSandbox

Developer Tools · Security · AI Agents

11,816

Instant, concurrent, hardware-isolated MicroVM sandboxes for AI agents — E2B-API compatible, sub-60ms cold starts, and a built-in zero-trust egress proxy, all self-hostable at scale.

View details
83
Repo Health
88
Technical
63
Dependency
Built with
Go32%
Rust28%
C23%
Updated yesterday

Join founders buildingwith open source

Opinionated takes, migration guides, cost-saving tips, and insights from the open source ecosystem.

Subscribe on Substack
Join 750+ subscribers

Search