punycode.js

A robust Punycode converter for internationalized domain names, fully compliant with RFC 3492 and RFC 5891.

Library
npm
v2.3.1
1,689stars
MIT License

Repository Health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum.How we score it →
42/100Fair
Development Activity0
Maintenance20
Community60
Maturity60
Momentum28

Technical Analysis

AI-assessed by reading the actual repository — architecture, code quality, innovation, and documentation.How we score it →
74/100Good
Architecture70
Code Quality80
Innovation55
Learning Curve90

Punycode.js is a JavaScript implementation of the Punycode algorithm, converting Unicode strings to and from the ASCII-only Punycode encoding used by internationalized domain names (IDN). It was built by comparing and optimizing several existing C and JavaScript Punycode implementations, resulting in an implementation that fully complies with RFC 3492 and RFC 5891, unlike several earlier ports.

The library exposes low-level encode/decode functions for raw Punycode strings as well as higher-level toASCII/toUnicode helpers that operate on entire domain names or email addresses, converting only the non-ASCII or Punycode-prefixed labels. It was bundled directly into Node.js core from v0.6.2 through v7 before being soft-deprecated and split back out into this standalone userland package.

What You Get

  • punycode.encode(string) / punycode.decode(string) for raw Unicode-to-ASCII Punycode conversion
  • punycode.toASCII(input) / punycode.toUnicode(input) that operate on full domain names or email addresses, converting only the relevant labels
  • A UCS-2 helper for safely handling astral (surrogate-pair) Unicode code points
  • Full RFC 3492 and RFC 5891 compliance, correcting bugs present in several earlier Punycode ports
  • Both a CommonJS build (punycode.js) and an ES module build (punycode.es6.js)
  • Zero runtime dependencies, working across modern Node.js and browser environments

Common Use Cases

  • Encoding an internationalized domain name (e.g. mañana.com) into its ASCII xn-- DNS-compatible form before a network request
  • Decoding a Punycode-encoded domain (xn--maana-pta.com) back to its human-readable Unicode form for display
  • Normalizing internationalized email addresses that mix Unicode local parts with Punycode domain parts
  • Replacing Node.js’s soft-deprecated built-in punycode core module with a maintained userland equivalent

Under The Hood

Architecture: The entire implementation lives in a single file, punycode.js (443 lines), organized around a small set of pure functions: low-level encode/decode implement the bootstring algorithm from RFC 3492 directly (variable-length integer encoding, adaptive bias, digit-to-basic mapping), while toASCII/toUnicode are thin wrappers that split a domain or email string on ./@ boundaries, apply encode/decode only to labels that need it (checking for the xn-- ACE prefix or non-ASCII characters), and rejoin the result. A small internal ucs2 helper (decode/encode) handles surrogate-pair-aware string-to-code-point conversion so the algorithm works correctly on astral Unicode characters, not just the BMP. Tech Stack: Pure JavaScript with zero runtime dependencies; ships both a CommonJS build (main: punycode.js) and an ES module build (module: punycode.es6.js) for dual consumption, targets Node.js >=6, and uses mocha/nyc/codecov for testing and coverage reporting during development. Code Quality: tests/tests.js (371 lines) exercises encode, decode, toASCII, toUnicode, and the ucs2 helpers against a broad matrix of fixtures including astral characters, mixed-case domains, and known-tricky RFC 3492 edge cases, giving strong confidence in correctness for an algorithm where subtle bugs are easy to introduce (the README explicitly documents that earlier ports, including Node.js’s own bundled version, were non-compliant). Development activity is low today (single maintainer, infrequent commits) but the code is algorithmically stable and rarely needs to change. API Design: The four-function surface (encode, decode, toASCII, toUnicode) maps directly onto how developers think about the problem — raw string transforms vs. domain/email-aware transforms — with no configuration objects or options to learn; the README’s copy-pasteable examples cover the entire API, and the explicit warning about Node’s core punycode module shadowing this package (requiring require('punycode/')) heads off the single most common integration gotcha directly in the docs.

Used by 11 apps in this directory

Go
72%
GPL 3.0

1Panel

Devops · Hosting Control Panel · Monitoring

36,573

The only open-source VPS control panel with native AI agent runtime — deploy websites, Docker stacks, and local LLMs from one web interface.

View details
91
Repo Health
76
Technical
67
Dependency
Built with
Go72%
Vue28%
Updated today
Rust
67%
MIT

Bun

Developer Tools

95,452

An all-in-one JavaScript and TypeScript toolkit — one Rust-and-JavaScriptCore binary that replaces Node.js, npm, a bundler, and a test runner with faster equivalents.

View details
92
Repo Health
91
Technical
66
Dependency
Built with
Rust67%
C++19%
Updated today
JavaScript
90%
Other

CodeSandbox

Code Editors · Developer Tools

13,633

Instantly ready browser-based IDE that runs full npm dependency resolution and transpilation entirely client-side, with no server needed.

View details
65
Repo Health
76
Technical
63
Dependency
Built with
JavaScript90%
Updated 1 months ago
PHP
78%
Other

Craft CMS

CMS

3,601

A developer-first PHP CMS with clean-slate content modeling, auto-generated GraphQL API, and a four-tier edition system that scales from solo projects to enterprise deployments.

View details
96
Repo Health
83
Technical
63
Dependency
Built with
PHP78%
JavaScript14%
Updated today
TypeScript
100%
Other

Dub

Marketing · Analytics

24,521

The open-source link attribution platform for short links, conversion tracking, and affiliate programs — powering 100M+ clicks monthly.

View details
81
Repo Health
78
Technical
65
Dependency
Built with
TypeScript100%
Updated today
TypeScript
74%
Apache 2.0

Jitsi Meet

Team Chat · Collaboration · Video Conferencing

29,767

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
70
Dependency
Built with
TypeScript74%
JavaScript10%
Updated yesterday
TypeScript
76%
Other

Joplin

Note Taking

56,003

The privacy-first, open-source note-taking app with end-to-end encrypted sync, AI assistance, and a powerful plugin ecosystem across every platform.

View details
93
Repo Health
87
Technical
62
Dependency
Built with
TypeScript76%
JavaScript15%
Updated yesterday
Ruby
60%
AGPL 3.0

Mastodon

Social Media

50,221

Run your own federated social network on the open ActivityPub standard with no ads, no algorithms, and no corporate control over your community.

View details
95
Repo Health
81
Technical
71
Dependency
Built with
Ruby60%
TypeScript22%
Updated today
JavaScript
98%
Apache 2.0

Parse Server

Developer Tools · Databases

21,409

Self-hosted Backend-as-a-Service for Node.js with REST, GraphQL, real-time Live Query, cloud code, and pluggable adapters for any infrastructure.

View details
96
Repo Health
81
Technical
78
Dependency
Built with
JavaScript98%
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

Search