Punycode.js is a robust JavaScript library for converting Unicode strings to Punycode and vice-versa, strictly adhering to RFC 3492 (Punycode) and RFC 5891 (IDNA2008). It provides low-level functions for encoding and decoding individual string parts, as well as higher-level utilities for processing entire domain names and email addresses. The current stable version is 2.3.1. While previously bundled with Node.js up to v7, the userland module (`npm install punycode`) now specifically targets modern Node.js v6+ environments and browsers supporting ES2015+ features. Version 1.4.1 remains available for broader compatibility with older runtimes like Rhino, Ringo, and Narwhal, offering the same functionality with a UMD build. The project is actively maintained with periodic releases.
npm install punycodeVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates how to encode and decode internationalized domain names (IDN) and individual Unicode string parts using `punycode.js`.
For compatibility with older runtimes (Rhino, Ringo, Narwhal, older browsers), use `punycode` v1.4.1. Otherwise, ensure your environment supports ES2015+.
Always use `require('punycode/')` (with the trailing slash) to explicitly load the npm package. Avoid `require('punycode')` if you intend to use the userland module, as it will load the built-in one.Install the `punycode` npm package via `npm install punycode` and import it using `require('punycode/')` or `import punycode from 'punycode';`.If you've installed the `punycode` npm package, ensure you are importing it with a trailing slash: `const punycode = require('punycode/');`.Upgrade your Node.js version to v6 or higher, or use a modern browser. If backward compatibility for older runtimes is essential, downgrade to `punycode` v1.4.1.
No dependency data recorded yet.