Fast, error-resilient, zero-dependency codecs for Dart.
BinaryΒ Β·Β OctalΒ Β·Β HexΒ Β·Β Base-32Β Β·Β Base-36Β Β·Β Base-45Β Β·Β Base-58Β Β·Β Base-62Β Β·Β Base-64Β Β·Β Base-85Β Β·Β Bech32Β Β·Β PunycodeΒ Β·Β IMAPΒ UTFβ7Β Β·Β MultibaseΒ Β·Β PercentΒ /Β URLΒ Β·Β QuotedβPrintableΒ Β·Β BigIntΒ Β·Β UTF-8Β /Β 16Β /Β 32Β Β·Β PHCΒ /Β ModularΒ Crypt
A pure-Dart library of fast, error-resilient codecs: binary, octal, hex, Base-32, Base-36, Base-45, Base-58, Base-62, Base-64, Base-85, Bech32, Punycode, IMAP UTF-7, multibase, percent (URL) encoding, quoted-printable, BigInt, UTF-8, UTF-16, UTF-32, and the PHC / Modular Crypt Format β with a rich set of alphabet variants, optional padding, and zero dependencies.
convertlib is the foundation layer of a three-package family:
Both hashlib (hashes, MACs, KDFs) and cipherlib (ciphers, AEAD, ML-KEM)
build on it, reusing its codecs to render digests, keys, and ciphertext as
text. It carries no runtime dependencies of its own.
| Feature | What you get | |
|---|---|---|
| π | Runs on every platform | Pure Dart with no native code or FFI β the same library works on the VM, Flutter (Android, iOS, Windows, macOS, Linux), and the web (dart2js and dart2wasm). |
| π¦ | Zero dependencies | Nothing is pulled into your dependency tree. |
| π‘ | Broad coverage | Base-2, Base-8, Base-16, Base-32, Base-36, Base-45, Base-58, Base-62, Base-64, Base-85, Bech32, Punycode, IMAP UTF-7, multibase, percent (URL) encoding, quoted-printable, BigInt, UTF-8, UTF-16, UTF-32, and the PHC / Modular Crypt Format, each with a symmetrical to/from pair. |
| ποΈ | Many alphabet variants | RFC 4648 standard, base32hex, Crockford, z-base-32, geohash, word-safe, URL/filename-safe Base-64, bcrypt, IMAP, and line-wrapped MIME and PEM. |
| β³οΈ | Optional padding | Encode and decode with or without = padding. |
| π‘οΈ | Error resilient | Decoders accept case and alphabet variations where the encoding allows it, and raise typed errors on genuinely invalid input. |
| π§© | Convenient output | Results integrate with ByteCollector, the digest container shared with hashlib, for one-call re-encoding. |
| βοΈ | Bytes or strings, throwing or not | Every encoder has a to<Name>Bytes twin returning a Uint8List, every decoder a non-throwing tryFrom<Name> returning null, plus a top-level constantTimeEquals. |
dependencies:
convertlib: ^3.7.0or run dart pub add convertlib. A single import exposes every codec:
import 'package:convertlib/convertlib.dart';Full API reference: convertlib library.
Every codec exposes a to<Name> encoder and a from<Name> decoder that are
exact inverses of each other:
import 'package:convertlib/convertlib.dart';
void main() {
final data = toUtf8('convertlib');
// Encode the same bytes in a few common ways
final hex = toHex(data);
final b64 = toBase64(data);
final b32 = toBase32(data);
print('bytes : $data');
print('hex : $hex');
print('base64 : $b64');
print('base32 : $b32');
// Every encoder has an exact inverse
print('decoded: ${fromUtf8(fromHex(hex))}');
print('match : ${fromUtf8(fromBase64(b64)) == 'convertlib'}');
}Every snippet in this README is also a runnable program in the example folder.
| Encoding | Class | Encode | Decode | Source |
|---|---|---|---|---|
| Binary (Base-2) | Base2Codec |
toBinary, toBinaryBytes |
fromBinary, tryFromBinary |
β |
| Octal (Base-8) | Base8Codec |
toOctal, toOctalBytes |
fromOctal, tryFromOctal |
β |
| Hexadecimal (Base-16) | Base16Codec |
toHex, toHexBytes |
fromHex, tryFromHex |
RFC-4648 |
| Base-32 | Base32Codec |
toBase32, toBase32Bytes |
fromBase32, tryFromBase32 |
RFC-4648 |
| Base-36 | Base36Codec |
toBase36, toBase36Bytes |
fromBase36, tryFromBase36 |
β |
| Base-45 | Base45Codec |
toBase45, toBase45Bytes |
fromBase45, tryFromBase45 |
RFC-9285 |
| Base-58 | Base58Codec |
toBase58, toBase58Bytes |
fromBase58, tryFromBase58 |
Draft |
| Base-62 | Base62Codec |
toBase62, toBase62Bytes |
fromBase62, tryFromBase62 |
β |
| Base-64 | Base64Codec |
toBase64, toBase64Bytes |
fromBase64, tryFromBase64 |
RFC-4648 |
| Base-85 | Base85Codec |
toBase85, toBase85Bytes |
fromBase85, tryFromBase85 |
Ascii85, Z85 |
| Bech32 | Bech32Codec |
toBech32 |
fromBech32, tryFromBech32 |
BIP-173, BIP-350 |
| SegWit address | SegwitCodec |
toSegwitAddress |
fromSegwitAddress, tryFromSegwitAddress |
BIP-173, BIP-350 |
| Punycode | PunycodeCodec |
toPunycode |
fromPunycode, tryFromPunycode |
RFC-3492, RFC-3490 |
| IMAP UTF-7 | ImapUtf7Codec |
toImapUtf7 |
fromImapUtf7, tryFromImapUtf7 |
RFC-3501 |
| Multibase | Multibase |
toMultibase |
fromMultibase, tryFromMultibase |
Multibase |
| Percent (URL) | PercentCodec |
toPercent, toPercentBytes |
fromPercent, tryFromPercent |
RFC-3986 |
| Quoted-Printable | QuotedPrintableCodec |
toQuotedPrintable, toQuotedPrintableBytes |
fromQuotedPrintable, tryFromQuotedPrintable |
RFC-2045, RFC-2047 |
| BigInt | BigIntCodec |
toBigInt |
fromBigInt, tryFromBigInt |
β |
| UTF-8 | UTF8Codec |
toUtf8 |
fromUtf8, tryFromUtf8 |
RFC-3629 |
| UTF-16 | UTF16Codec |
toUtf16 |
fromUtf16, tryFromUtf16 |
RFC-2781 |
| UTF-32 | UTF32Codec |
toUtf32 |
fromUtf32, tryFromUtf32 |
Unicode Β§3.9 |
| Modular Crypt Format | CryptFormat |
toCrypt |
fromCrypt |
PHC string format |
Each codec ships its variants as static const instances. Pick one with the
flags of to<Name>/from<Name>, or pass any instance as codec:. The
API reference
documents the exact behavior of each.
Alphabets (the default is listed first):
| Variant | Flag | Alphabet |
|---|---|---|
Base16Codec.lower |
0123456789abcdef |
|
Base16Codec.upper |
upper: true |
0123456789ABCDEF |
Base32Codec.standard |
ABCDEFGHIJKLMNOPQRSTUVWXYZ234567 |
|
Base32Codec.lowercase |
lower: true |
abcdefghijklmnopqrstuvwxyz234567 |
Base32Codec.hex |
0123456789ABCDEFGHIJKLMNOPQRSTUV |
|
Base32Codec.hexLower |
0123456789abcdefghijklmnopqrstuv |
|
Base32Codec.crockford |
0123456789ABCDEFGHJKMNPQRSTVWXYZ |
|
Base32Codec.geohash |
0123456789bcdefghjkmnpqrstuvwxyz |
|
Base32Codec.z |
ybndrfg8ejkmcpqxot1uwisza345h769 |
|
Base32Codec.wordSafe |
23456789CFGHJMPQRVWXcfghjmpqrvwx |
|
Base36Codec.standard |
0123456789abcdefghijklmnopqrstuvwxyz |
|
Base36Codec.upper |
upper: true |
0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ |
Base45Codec.standard |
0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./: (with a space) |
|
Base58Codec.standard |
123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz (Bitcoin) |
|
Base58Codec.flickr |
123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ |
|
Base58Codec.ripple |
rpshnaf39wBUDNEGHJKLM4PQRST7VWXYZ2bcdeCg65jkm8oFqi1tuvAxyz |
|
Base62Codec.standard |
0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz |
|
Base62Codec.lowerFirst |
lowerFirst: true |
0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ |
Base64Codec.standard |
A-Za-z0-9+/ |
|
Base64Codec.urlSafe |
url: true |
A-Za-z0-9-_ |
Base64Codec.bcrypt |
./A-Za-z0-9 |
|
Base64Codec.imap |
A-Za-z0-9+, |
|
Base85Codec.standard |
! to u (Ascii85; z for a zero group) |
|
Base85Codec.z85 |
0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ.-:+=^!/*?&<>()[]{}@%$# |
|
Base85Codec.git |
0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz!#$%&()*+-;<=>?@^_`{|}~ |
Base-32 and Base-64 take padding: to add or drop =. Base-36, Base-58 and
Base-62 read the input as one number, writing each leading zero byte as the
first character of the alphabet. Crockford decodes I/L as 1 and O as
0.
Formats (the default is listed first):
| Codec | Variants | Flags |
|---|---|---|
Base64Codec |
mime (76 columns, CRLF), pem (64 columns, LF), wrapped(lineLength, lineSeparator: ...) |
|
Base85Codec |
ipv6 (RFC 1924: 16 bytes as one 20-character number) |
|
Bech32Codec |
bech32 (BIP-173), bech32m (BIP-350), lightning (no length limit) |
m: true |
PunycodeCodec |
standard (bΓΌcher β bcher-kva), domain (mΓΌnchen.de β xn--mnchen-3ya.de) |
domain: true |
ImapUtf7Codec |
standard (strict decoding), lenient |
lenient: true |
PercentCodec |
standard (RFC 3986), component (encodeURIComponent), form (space as +), custom(...) |
component: true, form: true |
QuotedPrintableCodec |
standard (text), binary (escapes CRLF too), header (RFC 2047 "Q") |
binary: true, header: true |
BigIntCodec |
lsbFirst, msbFirst |
msbFirst: true |
UTF8Codec |
standard (throws), lenient (U+FFFD) |
allowMalformed: true |
UTF16Codec, UTF32Codec |
bigEndian, littleEndian, standard (byte order mark), or any combination as a const constructor |
littleEndian:, bom:, allowMalformed: |
Multibase |
every encoding of the multibase table except proquint and base256emoji; the prefix names it, so fromMultibase takes no other argument |
- Byte output β the
to<Name>Bytesencoders in the table above return the encoded ASCII as aUint8List, skipping the intermediateString. - Non-throwing decoders β the
tryFrom<Name>decoders returnnullinstead of throwing aFormatExceptionon invalid input. - Constant-time compare β
constantTimeEquals(a, b)compares two byte lists without exiting early on the first mismatch, for verifying MACs and digests. - Streaming β encoders and decoders support chunked conversion, so
encoder.bind(stream)converts a stream as it arrives, with the same output as converting it whole. See Streaming for the exceptions. - Low-level building blocks β the generic converters
BitEncoder/BitDecoder,ByteEncoder/ByteDecoder, andAlphabetEncoder/AlphabetDecoderare exported for building custom codecs.
ByteCollector is the byte container shared with hashlib, holding the output
of a hash or encoding function and re-encoding it on demand:
| Method / getter | Description |
|---|---|
bytes |
Raw bytes as Uint8List |
length |
Number of bytes |
buffer |
The backing ByteBuffer |
hex([upper]) |
Hexadecimal string (optionally uppercase) |
binary() / octal() |
Binary / octal string representation |
base32({upper, padding}) |
Base-32 encoding |
base64({urlSafe, padding}) |
Base-64 encoding |
base36({upper}) |
Base-36 encoding |
base45() |
Base-45 encoding (RFC 9285) |
base58({codec}) |
Base-58 encoding (Bitcoin alphabet default) |
base62({lowerFirst}) |
Base-62 encoding |
base85({codec}) |
Base-85 encoding (Ascii85 default) |
bech32(hrp, {m, codec}) |
Bech32 / Bech32m string with the human-readable hrp |
bigInt({endian}) |
Interprets the bytes as a BigInt (big endian default) |
number([bitLength, endian]) |
Reads an unsigned integer of the given bit-length |
ascii() / utf8() |
Decodes bytes as ASCII / UTF-8 (allowMalformed) |
to(encoding) |
Decodes bytes with a given dart:convert Encoding |
isEqual(other) |
Constant-time compare against bytes, buffer, or hex text |
The same bytes, rendered in each supported Base-32 alphabet β useful for human-friendly identifiers (Crockford), URLs (z-base-32), or geospatial codes (geohash):
import 'package:convertlib/convertlib.dart';
void main() {
final data = toUtf8('Hello, convertlib!');
print('standard : ${toBase32(data)}');
print('lowercase : ${toBase32(data, lower: true)}');
print('no padding : ${toBase32(data, padding: false)}');
print('base32hex : ${toBase32(data, codec: Base32Codec.hex)}');
print('crockford : ${toBase32(data, codec: Base32Codec.crockford)}');
print('z-base-32 : ${toBase32(data, codec: Base32Codec.z)}');
print('geohash : ${toBase32(data, codec: Base32Codec.geohash)}');
print('word-safe : ${toBase32(data, codec: Base32Codec.wordSafe)}');
// Decoding is the exact inverse of encoding
final back = fromBase32(toBase32(data));
print('roundtrip : ${fromUtf8(back)}');
}For tokens embedded in URLs or JSON, drop the padding and switch to the URL/filename-safe alphabet:
import 'package:convertlib/convertlib.dart';
void main() {
final data = toUtf8('a >> b, c/d');
print('standard : ${toBase64(data)}');
print('url-safe : ${toBase64(data, url: true)}');
print('no padding : ${toBase64(data, url: true, padding: false)}');
print('bcrypt : ${toBase64(data, codec: Base64Codec.bcrypt)}');
print('imap : ${toBase64(data, codec: Base64Codec.imap)}');
// MIME wraps lines at 76 columns with CRLF, PEM at 64 with LF, and both
// skip line breaks and other characters outside the alphabet when decoding.
final pem = toBase64(List.filled(60, 0xff), codec: Base64Codec.pem);
print('pem :\n$pem');
final mime = fromBase64('YSA+PiBi\r\nLCBjL2Q=', codec: Base64Codec.mime);
print('mime decode : ${fromUtf8(mime)}');
// Decode back to the original bytes
final back = fromBase64(toBase64(data, url: true));
print('roundtrip : ${fromUtf8(back)}');
}Read a byte sequence as an arbitrary-precision integer and back. Combine with
BigInt.toRadixString for a decimal (or any-base) string representation:
import 'package:convertlib/convertlib.dart';
void main() {
var input = [0x3, 0xF1];
print("input => $input");
var encoded = toBigInt(input).toRadixString(10);
print("to decimal => $encoded");
var decoded = fromBigInt(BigInt.parse(encoded, radix: 10));
print("from decimal => $decoded");
}Every encoder and decoder is a Converter, so bind converts a stream chunk
by chunk:
import 'dart:io';
import 'package:convertlib/convertlib.dart';
Future<void> main() async {
// Encode a file to Base-64 without reading it into memory at once.
final out = File('photo.b64').openWrite();
await out.addStream(
Base64Codec.standard.encoder
.bind(File('photo.jpg').openRead())
.cast<List<int>>(),
);
await out.close();
// Decode UTF-8 as it arrives; a character split between chunks is kept
// until the rest of it arrives.
final text = await UTF8Codec.standard.decoder
.bind(Stream.fromIterable([
[0x68, 0xE2, 0x82],
[0xAC]
]))
.map(String.fromCharCodes)
.join();
print(text); // hβ¬
}The output is the same as converting the whole input at once, with three exceptions:
- Base-36, Base-58, Base-62, and the IPv6 form of Base-85 read the whole input
as one number, so their
startChunkedConversionthrows anUnsupportedError. - Hex and binary put a partial group first (
fromHex('abc')is[0x0a, 0xbc]), so a stream throws aFormatExceptionif it ends with an odd number of hex digits, or a number of binary digits that is not a multiple of 8. - Octal also groups from the end, so it converts the whole stream when it closes.
Build and parse password-hash strings such as
$argon2id$v=19$m=65536,t=3,p=4$...$.... The builder Base-64 encodes salt and
hash bytes for you, and fromCrypt gives the fields back as typed accessors:
import 'package:convertlib/convertlib.dart';
void main() {
// Build a PHC / Modular Crypt Format string from its parts.
// `saltBytes` and `hashBytes` are Base-64 encoded (no padding) for you.
final data = CryptData.builder('argon2id')
.version('19')
.param('m', 65536)
.param('t', 3)
.param('p', 4)
.saltBytes(toUtf8('a-16-byte-salt!!'))
.hashBytes(List.generate(32, (i) => i))
.build();
final encoded = toCrypt(data);
print('encoded : $encoded');
// Parse the string back into its structured fields.
final parsed = fromCrypt(encoded);
print('id : ${parsed.id}');
print('version : ${parsed.versionInt()}');
print('m,t,p : ${parsed.getIntParam('m')}, '
'${parsed.getIntParam('t')}, ${parsed.getIntParam('p')}');
print('salt : ${fromUtf8(parsed.saltBytes()!)}');
print('hash : ${toHex(parsed.hashBytes()!)}');
}Codecs are trivial to get subtly wrong. It is not enough to check just the
decode(encode(x)) == x round-trips alone. For example: a dropped bit mask
can produce output that still passes round-trips cleanly. This package is
tested against that failure mode directly:
- Expectations come from outside the code. Every codec is checked against
official vectors (RFC 4648 "foobar", RFC 3629 UTF-8 boundaries, PHC / bcrypt
strings) and differentially against independent reference implementations:
dart:convert,base_codecs, andbase32, so a consistently-wrong codec cannot hide behind a passing round-trip. - Wide input coverage.
- Randomized round-trips at every length from 0 to 99 for each alphabet variant
- Full-range Unicode code points and surrogate-pair handling for UTF-8
- Per-instance assertions of the exact alphabet string each codec emits, which catch miscopied lookup tables.
- Failure paths are asserted, not assumed. Malformed UTF-8, invalid characters, and exhaustive invalid-length sweeps all verify that a typed error is raised (with the exact message and offset), never a silent wrong result.
- Every platform. The suite runs on the Dart VM, Node.js (JavaScript), and Chrome (WASM) in CI across Dart SDK 2.19 and stable on Linux, macOS, and Windows. Special care has been given for the web, where integers behave differently.
- Regressions stay fixed. Real bugs found in the past (a word-safe Base-32
table accidentally copied from z-base-32, a dropped
& 0x3Fmask in the UTF-8 decoder, aByteCollector.isEqualself-comparison) each have a permanent, externally-anchored regression test, and a differential fuzz harness re-checks the codecs against the reference implementations.
Because correctness is anchored to independent references rather than the
package's own agreement with itself, convertlib is safe to rely on in
production. If you do hit a discrepancy, please open an issue and include
your input and the expected output.
- Convertlib : https://pub.dev/packages/convertlib
- Base Codecs : https://pub.dev/packages/base_codecs
- Base32 : https://pub.dev/packages/base32
- Base X : https://pub.dev/packages/base_x
- Convert : https://pub.dev/packages/convert
- Hex : https://pub.dev/packages/hex
- PointyCastle : https://pub.dev/packages/pointycastle
- Dart Convert : https://api.dart.dev/stable/dart-convert/dart-convert-library.html
UTF-8 throughput is measured per source code point, not per byte. Crypt throughput is measured per character of the hash string. Base-36, Base-58 and Base-62 are quadratic in the input size, so they are measured only up to 1KB; larger cells are left empty.
| Codec | Library | 1MB message | 1KB message | 32B message |
|---|---|---|---|---|
| Base-2 | convertlib | ββββββββββββββββ 1.27 Gbps π |
ββββββββββββββββ 1.15 Gbps π |
ββββββββββββββββ 1.42 Gbps π |
| Base-8 | convertlib | ββββββββββββββββ 2.97 Gbps π |
ββββββββββββββββ 4.04 Gbps π |
ββββββββββββββββ 3.05 Gbps π |
| Base-16 | convertlib | ββββββββββββββββ 3.83 Gbps π |
ββββββββββββββββ 4.58 Gbps π |
ββββββββββββββββ 3.53 Gbps π |
| base_codecs | ββββββββββββββββ 173 Mbps π»22.14x |
ββββββββββββββββ 160 Mbps π»28.59x |
ββββββββββββββββ 154 Mbps π»22.92x |
|
| convert | ββββββββββββββββ 3.3 Gbps π»1.16x |
ββββββββββββββββ 4.03 Gbps π»1.14x |
ββββββββββββββββ 3.08 Gbps π»1.15x |
|
| hex | ββββββββββββββββ 136 Mbps π»28.16x |
ββββββββββββββββ 128 Mbps π»35.84x |
ββββββββββββββββ 125 Mbps π»28.24x |
|
| Base-32 | convertlib | ββββββββββββββββ 3.7 Gbps π |
ββββββββββββββββ 4.38 Gbps π |
ββββββββββββββββ 3.24 Gbps π |
| base_codecs | ββββββββββββββββ 307 Mbps π»12.05x |
ββββββββββββββββ 254 Mbps π»17.24x |
ββββββββββββββββ 224 Mbps π»14.46x |
|
| base32 | ββββββββββββββββ 244 Kbps π»15163.93x |
ββββββββββββββββ 58.5 Mbps π»74.87x |
ββββββββββββββββ 59.98 Mbps π»54.02x |
|
| Base-36 | convertlib | ββββββββββββββββ 199 Mbps π |
ββββββββββββββββ 1.12 Gbps π |
|
| BigInt | ββββββββββββββββ 5.59 Mbps π»35.6x |
ββββββββββββββββ 20.13 Mbps π»55.64x |
||
| Base-45 | convertlib | ββββββββββββββββ 4.39 Gbps π |
ββββββββββββββββ 5.18 Gbps π |
ββββββββββββββββ 3.97 Gbps π |
| Base-58 | convertlib | ββββββββββββββββ 164 Mbps π |
ββββββββββββββββ 1.35 Gbps π |
|
| base_codecs | ββββββββββββββββ 2.07 Mbps π»79.23x |
ββββββββββββββββ 51.53 Mbps π»26.18x |
||
| Base-62 | convertlib | ββββββββββββββββ 210 Mbps π |
ββββββββββββββββ 1.22 Gbps π |
|
| base_x | ββββββββββββββββ 3.55 Mbps π»59.02x |
ββββββββββββββββ 46.13 Mbps π»26.38x |
||
| Base-64 | convertlib | ββββββββββββββββ 4.35 Gbps π |
ββββββββββββββββ 5.04 Gbps π |
ββββββββββββββββ 3.75 Gbps π |
| dart:convert | ββββββββββββββββ 3.33 Gbps π»1.31x |
ββββββββββββββββ 3.72 Gbps π»1.36x |
ββββββββββββββββ 2.72 Gbps π»1.38x |
|
| Base-85 | convertlib | ββββββββββββββββ 4.03 Gbps π |
ββββββββββββββββ 4.6 Gbps π |
ββββββββββββββββ 3.57 Gbps π |
| base_codecs | ββββββββββββββββ 1.98 Gbps π»2.04x |
ββββββββββββββββ 2.38 Gbps π»1.93x |
ββββββββββββββββ 1.29 Gbps π»2.76x |
|
| Z85 | convertlib | ββββββββββββββββ 3.99 Gbps π |
ββββββββββββββββ 4.56 Gbps π |
ββββββββββββββββ 3.58 Gbps π |
| base_codecs | ββββββββββββββββ 2.29 Gbps π»1.74x |
ββββββββββββββββ 2.58 Gbps π»1.77x |
ββββββββββββββββ 1.96 Gbps π»1.83x |
|
| Bech32 | convertlib | ββββββββββββββββ 1.21 Gbps π |
ββββββββββββββββ 1.3 Gbps π |
ββββββββββββββββ 953 Mbps π |
| Punycode | convertlib | ββββββββββββββββ 751 Mbps π |
ββββββββββββββββ 782 Mbps π |
ββββββββββββββββ 777 Mbps π |
| IMAP UTF-7 | convertlib | ββββββββββββββββ 1.06 Gbps π |
ββββββββββββββββ 1.15 Gbps π |
ββββββββββββββββ 1.08 Gbps π |
| Percent | convertlib | ββββββββββββββββ 1.87 Gbps π |
ββββββββββββββββ 2.19 Gbps π |
ββββββββββββββββ 1.64 Gbps π |
| dart:core | ββββββββββββββββ 486 Mbps π»3.84x |
ββββββββββββββββ 512 Mbps π»4.27x |
ββββββββββββββββ 340 Mbps π»4.82x |
|
| Quoted-Printable | convertlib | ββββββββββββββββ 1.32 Gbps π |
ββββββββββββββββ 1.52 Gbps π |
ββββββββββββββββ 1.2 Gbps π |
| UTF-8 | convertlib | ββββββββββββββββ 2.57 Gbps π |
ββββββββββββββββ 2.82 Gbps π |
ββββββββββββββββ 2.3 Gbps π |
| dart:convert | ββββββββββββββββ 1.82 Gbps π»1.41x |
ββββββββββββββββ 1.95 Gbps π»1.45x |
ββββββββββββββββ 1.63 Gbps π»1.41x |
|
| UTF-8 (ASCII) | convertlib | ββββββββββββββββ 7.34 Gbps π |
ββββββββββββββββ 7.86 Gbps π |
ββββββββββββββββ 7.03 Gbps π |
| dart:convert | ββββββββββββββββ 3.72 Gbps π»1.97x |
ββββββββββββββββ 3.91 Gbps π»2.01x |
ββββββββββββββββ 2.97 Gbps π»2.37x |
|
| UTF-16 | convertlib | ββββββββββββββββ 2.47 Gbps π |
ββββββββββββββββ 2.7 Gbps π |
ββββββββββββββββ 2.18 Gbps π |
| UTF-32 | convertlib | ββββββββββββββββ 2.25 Gbps π |
ββββββββββββββββ 2.67 Gbps π |
ββββββββββββββββ 2.18 Gbps π |
| Codec | Library | 1MB message | 1KB message | 32B message |
|---|---|---|---|---|
| Base-2 | convertlib | ββββββββββββββββ 1.26 Gbps π |
ββββββββββββββββ 1.31 Gbps π |
ββββββββββββββββ 1.25 Gbps π |
| Base-8 | convertlib | ββββββββββββββββ 3.28 Gbps π |
ββββββββββββββββ 3.59 Gbps π |
ββββββββββββββββ 3.06 Gbps π |
| Base-16 | convertlib | ββββββββββββββββ 1.69 Gbps π |
ββββββββββββββββ 1.86 Gbps π |
ββββββββββββββββ 1.63 Gbps π |
| base_codecs | ββββββββββββββββ 160 Mbps π»10.56x |
ββββββββββββββββ 164 Mbps π»11.34x |
ββββββββββββββββ 158 Mbps π»10.32x |
|
| convert | ββββββββββββββββ 682 Mbps π»2.48x |
ββββββββββββββββ 692 Mbps π»2.69x |
ββββββββββββββββ 636 Mbps π»2.56x |
|
| hex | ββββββββββββββββ 159 Mbps π»10.63x |
ββββββββββββββββ 162 Mbps π»11.48x |
ββββββββββββββββ 149 Mbps π»10.94x |
|
| Base-32 | convertlib | ββββββββββββββββ 3.09 Gbps π |
ββββββββββββββββ 3.16 Gbps π |
ββββββββββββββββ 2.57 Gbps π |
| base_codecs | ββββββββββββββββ 203 Mbps π»15.23x |
ββββββββββββββββ 204 Mbps π»15.49x |
ββββββββββββββββ 182 Mbps π»14.15x |
|
| base32 | ββββββββββββββββ 104 Mbps π»29.63x |
ββββββββββββββββ 152 Mbps π»20.79x |
ββββββββββββββββ 119 Mbps π»21.68x |
|
| Base-36 | convertlib | ββββββββββββββββ 409 Mbps π |
ββββββββββββββββ 1.7 Gbps π |
|
| BigInt | ββββββββββββββββ 27.14 Mbps π»15.07x |
ββββββββββββββββ 47.25 Mbps π»35.87x |
||
| Base-45 | convertlib | ββββββββββββββββ 3.63 Gbps π |
ββββββββββββββββ 3.73 Gbps π |
ββββββββββββββββ 3.29 Gbps π |
| Base-58 | convertlib | ββββββββββββββββ 397 Mbps π |
ββββββββββββββββ 1.84 Gbps π |
|
| base_codecs | ββββββββββββββββ 2.34 Mbps π»169.54x |
ββββββββββββββββ 63.08 Mbps π»29.17x |
||
| Base-62 | convertlib | ββββββββββββββββ 407 Mbps π |
ββββββββββββββββ 1.84 Gbps π |
|
| base_x | ββββββββββββββββ 5.11 Mbps π»79.62x |
ββββββββββββββββ 161 Mbps π»11.43x |
||
| Base-64 | convertlib | ββββββββββββββββ 3.61 Gbps π |
ββββββββββββββββ 3.72 Gbps π |
ββββββββββββββββ 3.05 Gbps π |
| dart:convert | ββββββββββββββββ 2.21 Gbps π»1.63x |
ββββββββββββββββ 2.24 Gbps π»1.66x |
ββββββββββββββββ 1.82 Gbps π»1.68x |
|
| Base-85 | convertlib | ββββββββββββββββ 4.45 Gbps π |
ββββββββββββββββ 4.58 Gbps π |
ββββββββββββββββ 3.33 Gbps π |
| base_codecs | ββββββββββββββββ 41.14 Mbps π»108.17x |
ββββββββββββββββ 47.28 Mbps π»96.87x |
ββββββββββββββββ 40.9 Mbps π»81.45x |
|
| Z85 | convertlib | ββββββββββββββββ 4.45 Gbps π |
ββββββββββββββββ 4.59 Gbps π |
ββββββββββββββββ 3.55 Gbps π |
| base_codecs | ββββββββββββββββ 51.53 Mbps π»86.36x |
ββββββββββββββββ 51.28 Mbps π»89.51x |
ββββββββββββββββ 47.3 Mbps π»75.08x |
|
| Bech32 | convertlib | ββββββββββββββββ 834 Mbps π |
ββββββββββββββββ 878 Mbps π |
ββββββββββββββββ 683 Mbps π |
| Punycode | convertlib | ββββββββββββββββ 612 Mbps π |
ββββββββββββββββ 629 Mbps π |
ββββββββββββββββ 610 Mbps π |
| IMAP UTF-7 | convertlib | ββββββββββββββββ 511 Mbps π |
ββββββββββββββββ 531 Mbps π |
ββββββββββββββββ 457 Mbps π |
| Percent | convertlib | ββββββββββββββββ 1.62 Gbps π |
ββββββββββββββββ 1.68 Gbps π |
ββββββββββββββββ 1.37 Gbps π |
| dart:core | ββββββββββββββββ 213 Mbps π»7.61x |
ββββββββββββββββ 442 Mbps π»3.8x |
ββββββββββββββββ 395 Mbps π»3.47x |
|
| Quoted-Printable | convertlib | ββββββββββββββββ 2.06 Gbps π |
ββββββββββββββββ 2.12 Gbps π |
ββββββββββββββββ 1.68 Gbps π |
| UTF-8 | convertlib | ββββββββββββββββ 1.33 Gbps π |
ββββββββββββββββ 1.4 Gbps π |
ββββββββββββββββ 903 Mbps |
| dart:convert | ββββββββββββββββ 1.26 Gbps π»1.06x |
ββββββββββββββββ 1.28 Gbps π»1.09x |
ββββββββββββββββ 1.18 Gbps πΊ1.31x |
|
| UTF-8 (ASCII) | convertlib | ββββββββββββββββ 37.04 Gbps |
ββββββββββββββββ 82.82 Gbps |
ββββββββββββββββ 8.53 Gbps |
| dart:convert | ββββββββββββββββ 37.71 Gbps πΊ1.02x |
ββββββββββββββββ 85.54 Gbps πΊ1.03x |
ββββββββββββββββ 11.26 Gbps πΊ1.32x |
|
| UTF-16 | convertlib | ββββββββββββββββ 705 Mbps π |
ββββββββββββββββ 727 Mbps π |
ββββββββββββββββ 562 Mbps π |
| UTF-32 | convertlib | ββββββββββββββββ 587 Mbps π |
ββββββββββββββββ 606 Mbps π |
ββββββββββββββββ 498 Mbps π |
| Codec | Library | 4KB message | 256B message | 32B message |
|---|---|---|---|---|
| bytes β BigInt | convertlib | ββββββββββββββββ 504 Mbps π |
ββββββββββββββββ 583 Mbps π |
ββββββββββββββββ 692 Mbps π |
| hex + BigInt.parse | ββββββββββββββββ 187 Mbps π»2.7x |
ββββββββββββββββ 182 Mbps π»3.2x |
ββββββββββββββββ 93.45 Mbps π»7.4x |
|
| pointycastle | ββββββββββββββββ 12.42 Mbps π»40.57x |
ββββββββββββββββ 102 Mbps π»5.72x |
ββββββββββββββββ 188 Mbps π»3.68x |
|
| BigInt β bytes | convertlib | ββββββββββββββββ 144 Mbps π |
ββββββββββββββββ 144 Mbps |
ββββββββββββββββ 131 Mbps |
| toRadixString + fromHex | ββββββββββββββββ 143 Mbps π»1.01x |
ββββββββββββββββ 143 Mbps π»1x |
ββββββββββββββββ 131 Mbps π»1x |
|
| pointycastle | ββββββββββββββββ 29.86 Mbps π»4.82x |
ββββββββββββββββ 203 Mbps πΊ1.41x |
ββββββββββββββββ 295 Mbps πΊ2.26x |
| Codec | Library | argon2id (96 chars) | bcrypt (60 chars) |
|---|---|---|---|
| fromCrypt | convertlib | ββββββββββββββββ 997 Mbps π |
ββββββββββββββββ 1.43 Gbps π |
| toCrypt | convertlib | ββββββββββββββββ 655 Mbps π |
ββββββββββββββββ 1.06 Gbps π |
All benchmarks are done on AMD Ryzen 7 5800X CPU + 3200MHz RAM using compiled exe
Dart SDK version: 3.14.0 (stable) (Wed Nov 4 16:28:39 2026 -0800) on "windows_x64"
BSD 3-Clause License. See the LICENSE file for details. Issues and contributions are welcome at github.com/bitanon/convertlib.