base64

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

Library
Cargo
v0.23.1
740 stars
Apache License 2.0

Repository Health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum. How we score it →
56 /100 Fair
Development Activity 44
Maintenance 24
Community 68
Maturity 60
Momentum 28

Technical Analysis

AI-assessed by reading the actual repository — architecture, code quality, innovation, and documentation. How we score it →
85 /100 Excellent
Architecture 85
Code Quality 90
Innovation 80
Learning Curve 85

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 66 apps in this directory

Rust
94%
Apache 2.0

helix-db

Databases

6,233

A graph-vector database built from scratch in Rust that unifies graph traversal, vector search, key-value, and relational storage into a single platform for AI applications.

View details
86
Repo Health
80
Technical
76
Dependency
Built with
Rust 94%
Updated 1 weeks ago
Rust
94%
Apache 2.0

herdr

AI Agents · Developer Tools

45,586

A terminal-native agent multiplexer that runs Claude, Codex, Gemini, and other coding agents side by side in real, persistent panes you can detach from and reattach to from anywhere.

View details
84
Repo Health
84
Technical
73
Dependency
Built with
Rust 94%
Updated 1 weeks ago
Rust
37%
Other

Hook0

Devops

1,504

Open-source Webhooks-as-a-Service: deliver events to your users with auto-retry, signed payloads, and a real-time subscriber dashboard — all without building the infrastructure yourself.

View details
84
Repo Health
82
Technical
69
Dependency
Built with
Rust 37%
TypeScript 12%
Updated 1 weeks ago
Go
69%
MIT

hoop

Monitoring · Security

836

A wire-protocol gateway that enforces data masking, command blocking, approval workflows, and full session recording for engineers and AI agents accessing production infrastructure.

View details
86
Repo Health
80
Technical
64
Dependency
Built with
Go 69%
Clojure 13%
Updated 6 days ago
TypeScript
68%
MIT

Hoppscotch

Developer Tools

80,676

A lightweight, offline-capable API development ecosystem for testing HTTP, GraphQL, WebSocket, MQTT, and SSE endpoints across web, desktop, and CLI.

View details
91
Repo Health
83
Technical
62
Dependency
Built with
TypeScript 68%
Vue 24%
Updated 1 weeks ago
Rust
72%
Other

iii

Developer Tools · Devops

18,854

Compose, extend, and observe every backend service in real time using three primitives: Workers, Functions, and Triggers.

View details
87
Repo Health
85
Technical
65
Dependency
Built with
Rust 72%
TypeScript 16%
Updated 1 weeks ago
Rust
96%
Apache 2.0

InfluxDB

Analytics · Databases

31,779

Open-source time-series database built for real-time ingest, fast SQL queries, and embedded Python automation — powered by Apache Arrow and Parquet.

View details
80
Repo Health
76
Technical
72
Dependency
Built with
Rust 96%
Updated 1 weeks ago
Rust
56%
Other

Jan

AI Assistants

45,052

Run LLMs 100% locally with full privacy, or connect to cloud AI — your machine, your data, your control.

View details
90
Repo Health
81
Technical
65
Dependency
Built with
Rust 56%
TypeScript 40%
Updated 6 days ago
TypeScript
44%
MIT

Kuku

Note Taking

230

A local-first, open-source Markdown knowledge workspace for macOS — plain files, personal wiki and Second Brain workflows, AI-assisted diffs, and encrypted sync, built as an Obsidian alternative.

View details
77
Repo Health
67
Technical
67
Dependency
Built with
TypeScript 44%
Rust 41%
Updated 1 weeks ago

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