Gathering detailed insights and metrics for punycode
Gathering detailed insights and metrics for punycode
Gathering detailed insights and metrics for punycode
Gathering detailed insights and metrics for punycode
tr46
An implementation of the Unicode UTS #46: Unicode IDNA Compatibility Processing
@types/punycode
TypeScript definitions for punycode
punycode.js
A robust Punycode converter that fully complies to RFC 3492 and RFC 5891, and works on nearly all JavaScript platforms.
punycode2
Modular version of punycode package
A robust Punycode converter that fully complies to RFC 3492 and RFC 5891.
npm install punycode
Typescript
Module System
Min. Node Version
Node Version
NPM Version
JavaScript (100%)
Total Downloads
20,231,809,450
Last Day
16,788,228
Last Week
92,552,641
Last Month
395,222,410
Last Year
4,249,405,763
MIT License
1,631 Stars
150 Commits
159 Forks
37 Watchers
2 Branches
19 Contributors
Updated on May 07, 2025
Minified
Minified + Gzipped
Latest Version
2.3.1
Package Id
punycode@2.3.1
Unpacked Size
32.73 kB
Size
7.42 kB
File Count
5
NPM Version
10.1.0
Node Version
20.9.0
Published on
Oct 30, 2023
Cumulative downloads
Total Downloads
Last Day
43.7%
16,788,228
Compared to previous day
Last Week
5%
92,552,641
Compared to previous week
Last Month
-0.6%
395,222,410
Compared to previous month
Last Year
8.7%
4,249,405,763
Compared to previous year
Punycode.js is a robust Punycode converter that fully complies to RFC 3492 and RFC 5891.
This JavaScript library is the result of comparing, optimizing and documenting different open-source implementations of the Punycode algorithm:
punycode.c
by Markus W. Scherer (IBM)punycode.c
by Ben Noordhuispunycode.js
by Ben Noordhuis (note: not fully compliant)This project was bundled with Node.js from v0.6.2+ until v7 (soft-deprecated).
This project provides a CommonJS module that uses ES2015+ features and JavaScript module, which work in modern Node.js versions and browsers. For the old Punycode.js version that offers the same functionality in a UMD build with support for older pre-ES2015 runtimes, including Rhino, Ringo, and Narwhal, see v1.4.1.
Via npm:
1npm install punycode --save
In Node.js:
⚠️ Note that userland modules don't hide core modules. For example,
require('punycode')
still imports the deprecated core module even if you executednpm install punycode
. Userequire('punycode/')
to import userland modules rather than core modules.
1const punycode = require('punycode/');
punycode.decode(string)
Converts a Punycode string of ASCII symbols to a string of Unicode symbols.
1// decode domain name parts 2punycode.decode('maana-pta'); // 'mañana' 3punycode.decode('--dqo34k'); // '☃-⌘'
punycode.encode(string)
Converts a string of Unicode symbols to a Punycode string of ASCII symbols.
1// encode domain name parts 2punycode.encode('mañana'); // 'maana-pta' 3punycode.encode('☃-⌘'); // '--dqo34k'
punycode.toUnicode(input)
Converts a Punycode string representing a domain name or an email address to Unicode. Only the Punycoded parts of the input will be converted, i.e. it doesn’t matter if you call it on a string that has already been converted to Unicode.
1// decode domain names
2punycode.toUnicode('xn--maana-pta.com');
3// → 'mañana.com'
4punycode.toUnicode('xn----dqo34k.com');
5// → '☃-⌘.com'
6
7// decode email addresses
8punycode.toUnicode('джумла@xn--p-8sbkgc5ag7bhce.xn--ba-lmcq');
9// → 'джумла@джpумлатест.bрфa'
punycode.toASCII(input)
Converts a lowercased Unicode string representing a domain name or an email address to Punycode. Only the non-ASCII parts of the input will be converted, i.e. it doesn’t matter if you call it with a domain that’s already in ASCII.
1// encode domain names
2punycode.toASCII('mañana.com');
3// → 'xn--maana-pta.com'
4punycode.toASCII('☃-⌘.com');
5// → 'xn----dqo34k.com'
6
7// encode email addresses
8punycode.toASCII('джумла@джpумлатест.bрфa');
9// → 'джумла@xn--p-8sbkgc5ag7bhce.xn--ba-lmcq'
punycode.ucs2
punycode.ucs2.decode(string)
Creates an array containing the numeric code point values of each Unicode symbol in the string. While JavaScript uses UCS-2 internally, this function will convert a pair of surrogate halves (each of which UCS-2 exposes as separate characters) into a single code point, matching UTF-16.
1punycode.ucs2.decode('abc'); 2// → [0x61, 0x62, 0x63] 3// surrogate pair for U+1D306 TETRAGRAM FOR CENTRE: 4punycode.ucs2.decode('\uD834\uDF06'); 5// → [0x1D306]
punycode.ucs2.encode(codePoints)
Creates a string based on an array of numeric code point values.
1punycode.ucs2.encode([0x61, 0x62, 0x63]); 2// → 'abc' 3punycode.ucs2.encode([0x1D306]); 4// → '\uD834\uDF06'
punycode.version
A string representing the current Punycode.js version number.
On the main
branch, bump the version number in package.json
:
1npm version patch -m 'Release v%s'
Instead of patch
, use minor
or major
as needed.
Note that this produces a Git commit + tag.
Push the release commit and tag:
1git push && git push --tags
Our CI then automatically publishes the new release to npm, under both the punycode
and punycode.js
names.
Mathias Bynens |
Punycode.js is available under the MIT license.
No vulnerabilities found.
Reason
no dangerous workflow patterns detected
Reason
no binaries found in the repo
Reason
0 existing vulnerabilities detected
Reason
license file detected
Details
Reason
Found 13/30 approved changesets -- score normalized to 4
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
dependency not pinned by hash detected -- score normalized to 0
Details
Reason
detected GitHub workflow tokens with excessive permissions
Details
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
project is not fuzzed
Details
Reason
branch protection not enabled on development/release branches
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Score
Last Scanned on 2025-04-28
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More