base64-js

Pure JavaScript base64 encoding and decoding for byte arrays, with no native dependencies.

Library
npm
v1.5.1
881stars
MIT License

Repository Health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum.How we score it →
39/100Needs Attention
Development Activity0
Maintenance0
Community76
Maturity60
Momentum20

Technical Analysis

AI-assessed by reading the actual repository — architecture, code quality, innovation, and documentation.How we score it →
55/100Fair
Architecture65
Code Quality55
Innovation65
Learning Curve35

base64-js is a small, dependency-free JavaScript library that converts between base64 strings and byte arrays (Uint8Array). It underpins Node.js’s Buffer polyfill behavior in the browser and is one of the most widely used low-level encoding utilities in the npm ecosystem, pulled in transitively by bundlers, blockchain libraries, and countless other packages that need binary-safe base64 handling outside of Node.

The library exposes exactly three functions — byteLength, toByteArray, and fromByteArray — covering the full round-trip between base64 text and raw bytes, including URL-safe base64 variants and correct handling of padding characters.

What You Get

  • byteLength(b64) - Computes the exact decoded byte length of a base64 string without allocating memory
  • toByteArray(b64) - Decodes a base64 string into a Uint8Array (or plain Array in older environments)
  • fromByteArray(uint8) - Encodes a Uint8Array into a base64 string, chunked for large inputs
  • URL-safe decoding - Accepts - and _ characters as used in URL-safe base64 variants

Common Use Cases

  • Browser Buffer polyfills - Powers base64 encode/decode inside browserify’s and other bundlers’ Buffer shims
  • Binary data transport - Encoding binary payloads such as images, files, or crypto keys for JSON or URL-safe transmission
  • Blockchain and crypto libraries - Widely used as a transitive dependency for encoding binary keys and signatures
  • Legacy browser support - Provides base64 handling in browsers lacking native byte-array-aware atob/btoa behavior

Under The Hood

Architecture The entire module lives in a single file, index.js, with a flat structure: three exported functions (byteLength, toByteArray, fromByteArray) plus a handful of internal helpers (getLens, _byteLength, tripletToBase64, encodeChunk) and two lookup tables built once at module load. There are no classes and no shared mutable state between calls — each call is a pure function-in/value-out transform — so the encode/decode implementation could be swapped out without touching any calling code beyond the same three exports.

Tech Stack The shipped entry point is plain CommonJS JavaScript (exports.foo = ...) requiring no build step to consume; a hand-written index.d.ts supplies TypeScript typings alongside it. Development tooling includes browserify to produce a browser-ready bundle, babel-minify to minify that bundle, the standard linter for style enforcement, tape for unit tests, and benchmark for performance comparisons.

Code Quality Tests under test/ (convert.js, corrupt.js, url-safe.js, big-data.js) run via tape and cover round-trip conversion, malformed-input length validation, URL-safe alphabet decoding, and large-buffer handling — a reasonable suite for a small module. Error handling is explicit where it matters (invalid base64 length throws rather than silently failing), and naming and style are kept consistent via the standard linter. CI is configured through a legacy Travis config, and the project shows limited recent maintenance activity.

API Design The public surface is about as minimal as it gets — three top-level functions with no options objects or classes to instantiate — so there is almost no boilerplate to get started. Naming (byteLength/toByteArray/fromByteArray) mirrors Node’s Buffer conventions, letting developers already familiar with Buffer transfer that knowledge immediately. Documentation is limited to a short README methods list and a few explanatory code comments, but the shipped type declarations serve as an informal secondary reference.

Used by 9 apps in this directory

Python
56%
Other

authentik

Authentication · Security

25,385

The self-hosted Identity Provider that replaces Okta, Auth0, and Entra ID with a unified SSO platform supporting SAML, OAuth2/OIDC, LDAP, RADIUS, and WebAuthn.

View details
92
Repo Health
81
Technical
66
Dependency
Built with
Python56%
TypeScript34%
Updated yesterday
Go
54%
Apache 2.0

Authgear

Authentication

2,028

Open-source, self-hostable authentication platform with passkeys, biometric login, SSO, MFA, and GraphQL admin API — a full Auth0/Clerk/Firebase alternative for SaaS and mobile apps.

View details
88
Repo Health
81
Technical
68
Dependency
Built with
Go54%
HTML25%
TypeScript18%
Updated 3 days ago
TypeScript
45%
Other

Convex Backend

Developer Tools · Databases

12,494

Open-source reactive database that lets developers build live-updating apps with pure TypeScript, strong consistency, and real-time subscriptions—no separate API layer required.

View details
87
Repo Health
82
Technical
68
Dependency
Built with
TypeScript45%
Rust43%
Updated 2 days ago
TypeScript
61%
EPL-2.0

Huly Platform

Project Management · Team Chat · Collaboration

27,586

Open-source all-in-one workspace that replaces Linear, Jira, Slack, and Notion for product and engineering teams.

View details
89
Repo Health
86
Technical
62
Dependency
Built with
TypeScript61%
Svelte34%
Updated 1 weeks ago
TypeScript
74%
Apache 2.0

Jitsi Meet

Team Chat · Collaboration · Video Conferencing

29,879

Open-source, end-to-end encrypted video conferencing you can self-host or embed into any web or mobile app.

View details
96
Repo Health
85
Technical
69
Dependency
Built with
TypeScript74%
JavaScript10%
Updated yesterday
TypeScript
98%
Other

Kibana

Analytics · Monitoring

21,284

Your open source window into the Elastic Stack — query, visualize, and act on data stored in Elasticsearch with real-time dashboards, AI-assisted search, and automated alerting.

View details
98
Repo Health
87
Technical
66
Dependency
Built with
TypeScript98%
Updated yesterday
Python
68%
MIT

Langflow

AI Agents · AI Development

154,349

Build, test, and deploy AI agents and RAG workflows visually with native API and MCP server export.

View details
90
Repo Health
85
Technical
65
Dependency
Built with
Python68%
TypeScript23%
Updated today
TypeScript
98%
AGPL 3.0

paseo

AI Agents · AI Code Assistants

16,216

One unified interface to orchestrate Claude Code, Codex, Copilot, OpenCode, and Pi agents in parallel from desktop, mobile, or the terminal.

View details
87
Repo Health
83
Technical
68
Dependency
Built with
TypeScript98%
Updated yesterday
JavaScript
94%
Apache 2.0

swagger-ui

Developer Tools

29,002

Transform OpenAPI specifications into interactive, browser-based API documentation that developers and consumers can explore and test live.

View details
97
Repo Health
83
Technical
65
Dependency
Built with
JavaScript94%
Updated 2 days 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

Search