PHPackages                             artbit/base\_convert - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. artbit/base\_convert

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

artbit/base\_convert
====================

Base conversion utility that supports number bases from 2 to 64 (PHP's builtin base\_convert supports number bases from 2 through 36)

v1.0(10y ago)510.8k↓75%MITPHP

Since May 12Pushed 4y agoCompare

[ Source](https://github.com/ArtBIT/base_convert)[ Packagist](https://packagist.org/packages/artbit/base_convert)[ Docs](https://github.com/artbit/base_convert)[ RSS](/packages/artbit-base-convert/feed)WikiDiscussions master Synced 2mo ago

READMEChangelog (1)DependenciesVersions (2)Used By (0)

Base Convert \[2..64\]
======================

[](#base-convert-264)

[![Build Status](https://camo.githubusercontent.com/2d7e4d0f3456d4b7b1708692cb1244c6d239f8156e33040f4fc3df4f5923d51e/68747470733a2f2f7472617669732d63692e6f72672f4172744249542f626173655f636f6e766572742e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/ArtBIT/base_convert) [![GitHub license](https://camo.githubusercontent.com/98afda9d7fc882fa25dcc1fbb65ab192b8e5a2f88835a836293d9707eabe8e7b/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f4172744249542f626173655f636f6e766572742e737667)](https://github.com/ArtBIT/base_convert) [![GitHub stars](https://camo.githubusercontent.com/63f51b0a0cb3f687b50f5d4186a5d01333e507614dd9913988478c9d632e2320/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f73746172732f4172744249542f626173655f636f6e766572742e737667)](https://github.com/ArtBIT/base_convert) [![awesomeness](https://camo.githubusercontent.com/ed89bbb490f665ad6cc8f2a4b5508d46f4964ce17ca53c2a418a5cdadfd752c9/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f617765736f6d656e6573732d6d6178696d756d2d7265642e737667)](https://github.com/ArtBIT/base_convert)

PHP's built in `base_convert` function supports bases ranging from 2 to 36. This library expands that range to 2 to 64.

Usage
=====

[](#usage)

Convert a number 100 from decimal to hexadecimal (from base 10 to base 16):

```
echo math\base_convert(100, 10, 16);
// echoes '64'
```

...and back:

```
echo math\base_convert(64, 16, 10);
// echoes '100'
```

Custom alphabets
----------------

[](#custom-alphabets)

Instead of integer bases, you can pass in the alphabet string to use for conversion (since integer bases are converted to alphabet strings anyways, i.e. hexadecimal alphabet is simply "0123456789abcdef").

Here we convert from base 10 to alphabet 'customizable'

```
echo math\base_convert(1234567890, 10, 'customizable');
// echoes 'slmmmmcui'
```

Here we convert from alphabet 'customizable' to alphabet 'isogram'

```
echo math\base_convert('slmmmmcui', 'customizable', 'isogram');
// echoes 'rorsirrioig'
```

And from alphabet 'isogram' back to base 10

```
echo math\base_convert('rorsirrioig', 'isogram', 10);
// echoes '1234567890'
```

So both `slmmmmcui` and `rorsirrioig`, but also `1234567890` describe the same value, but in different alphabets.

*NOTE:* All alphabets must be [isograms](https://en.wikipedia.org/wiki/Isogram)An isogram (also known as a "nonpattern word") is a logological term for a word or phrase without a repeating letter. Conveniently, the word `isogram` is an isogram as well.

License
=======

[](#license)

[MIT](LICENSE)

###  Health Score

33

—

LowBetter than 75% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity26

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity63

Established project with proven stability

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

3658d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/54927d0d649eaab56232a2a6f52d5bd5fc5a9e69a47112645b94c44d70d2d116?d=identicon)[ArtBIT](/maintainers/ArtBIT)

---

Top Contributors

[![ArtBIT](https://avatars.githubusercontent.com/u/184220?v=4)](https://github.com/ArtBIT "ArtBIT (39 commits)")

---

Tags

base-conversionnumber-converterphputilitybase64mathnumberbase conversion

### Embed Badge

![Health badge](/badges/artbit-base-convert/health.svg)

```
[![Health](https://phpackages.com/badges/artbit-base-convert/health.svg)](https://phpackages.com/packages/artbit-base-convert)
```

###  Alternatives

[brick/math

Arbitrary-precision arithmetic library

2.1k504.0M277](/packages/brick-math)[nette/utils

🛠 Nette Utils: lightweight utilities for string &amp; array manipulation, image handling, safe JSON encoding/decoding, validation, slug or strong password generating etc.

2.1k394.3M1.5k](/packages/nette-utils)[paragonie/constant_time_encoding

Constant-time Implementations of RFC 4648 Encoding (Base-64, Base-32, Base-16)

903329.7M148](/packages/paragonie-constant-time-encoding)[spomky-labs/base64url

Base 64 URL Safe Encoding/Decoding PHP Library

15439.5M49](/packages/spomky-labs-base64url)[php-decimal/php-decimal

Correctly-rounded arbitrary precision decimal floating point

781.0M9](/packages/php-decimal-php-decimal)[phpcsstandards/phpcsutils

A suite of utility functions for use with PHP\_CodeSniffer

6333.4M58](/packages/phpcsstandards-phpcsutils)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
