base62str
v2.0.0
Published
Encode a string into a base62 string. Decode a base62 string back to a decoded string. It can also code arrays of bytes.
Downloads
27,221
Maintainers
Readme
base62str
Encode/Decode strings to Base62 strings. Useful to convert any string to an encoded string that only contains letters and numbers.
🔢 Try the Live Demo — Encode & decode Base62 strings instantly, right in your browser.
How to install:
npm install base62str
How to include
import Base62Str from "base62str";If you want to use the library in nodejs then use require as follows:
const Base62Str = require("base62str").default;Or, directly in the browser with no build step, via a <script> tag (exposes a Base62Str global):
<script src="https://unpkg.com/base62str/dist/index.global.js"></script>To use
Create an instance
First create an instance:
const base62 = Base62Str.createInstance(); If you prefer you can create an instance with inverted CharacterSet:
const base62 = Base62Str.createInstanceWithInvertedCharacterSet();Encoding:
const encodedString = base62.encodeStr("Hello World!");
// encodedString => T8dgcjRGkZ3aysdNDecoding:
const decodedString = base62.decodeStr(encodedString);
// decodedString => Hello World!Donations & Sponsoring
Creating and maintaining open-source libraries is a passion of mine. If you find this library useful and it saves you time, please consider supporting its development. Your contributions help keep the project active and motivated!
Every bit of support—whether it's sponsoring on GitHub, a coffee, a star, or a shout-out, is deeply appreciated. Thank you for being part of the community!


