Base62.js
A Base62 encode/decoder for node
Install / Use
/learn @base62/Base62.jsREADME
Base62.js
A JavaScript Base62 encode/decoder.
Base62 encoding converts numbers to ASCII strings (0-9, a-z and A-Z) and vice versa, which typically results in comparatively short strings. Such identifiers also tend to be more readily identifiable by humans.
999->"g7"9999->"2Bh"238327->"ZZZ"
Installation
npm install base62
Usage
var base62 = require("base62");
base62.encode(999); // "g7"
base62.decode("g7"); // 999
Both encode and decode support BigInt for values beyond Number.MAX_SAFE_INTEGER:
base62.encode(9007199254740993n); // "FfGNdXsE9"
base62.decode("FfGNdXsE9", { bigint: true }); // 9007199254740993n
You can also use a custom character set:
var base62 = require("base62");
base62.setCharacterSet("~9876543210ABCDEFGHIJKLMNOPQRSTU$#@%!abcdefghijklmnopqrstuvw-=");
base62.encode(999); // "F3"
base62.decode("F3"); // 999
setCharacterSet expects a string containing exactly 62 unique characters.
Development
Source code is hosted on GitHub. Please report issues or feature requests in GitHub Issues.
- Fork the project.
- Make your feature addition or bug fix.
- Add tests for it.
- Send a pull request.
License
MIT. Copyright (c) 2026 Andrew Nesbitt. See LICENSE for details.
Related Skills
node-connect
344.1kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
96.8kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
openai-whisper-api
344.1kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
qqbot-media
344.1kQQBot 富媒体收发能力。使用 <qqmedia> 标签,系统根据文件扩展名自动识别类型(图片/语音/视频/文件)。
