Sexydecimal is a hexadecimal encoding scheme with a couple of nifty features that make it nice for transmitting encoded integers.
Z through O are zero through fifteen (positive terminal digits),
a through o are negative one through negative fifteen (negative terminal
digits), and 0-9, T-Y are used for higher-order digits (continuations).
Negative multiples of sixteen use z as a terminal (e.g. -16 → 1z,
-32 → 2z); z must always follow at least one continuation digit.
This way, you can encode a series of positive and/or negative integers without need for delimiters. For example, the first ten powers of negative two in base 10:
1, -2, 4, -8, 16, -32, 64, -128, 256, -512
Sexydecimal:
AbDh1Z2z4Z8z10Z20z
Much better.
| Character(s) | Role | Values |
|---|---|---|
Z, A-O |
Positive terminal (ones digit) | 0, 1–15 |
a-o |
Negative terminal (ones digit) | −1 to −15 |
z |
Negative-zero terminal | −(n×16); must follow a continuation digit |
0-9, T-Y |
Continuation (high-order digits) | 0–9, 10–15 |
from sexydecimal import sexyencode, sexydecode
print(sexyencode([1, 10, 100, 1000])) # AJ6D3XH
print(sexydecode("AbDh1Z2z4Z8z10Z20z")) # [1, -2, 4, -8, 16, -32, 64, -128, 256, -512]
js/sexydecimal.js works as a browser script, an inline <script>, or a Node.js module.
Browser / inline
<script src="sexydecimal.js"></script>
<script>
console.log(sexyencode([1, 10, 100, 1000])); // AJ6D3XH
console.log(sexydecode("AbDh1Z2z4Z8z10Z20z")); // [1, -2, 4, -8, 16, -32, 64, -128, 256, -512]
</script>
Node.js
const { sexyencode, sexydecode } = require('./sexydecimal.js');
console.log(sexyencode([1, 10, 100, 1000])); // AJ6D3XH
console.log(sexydecode("AbDh1Z2z4Z8z10Z20z")); // [1, -2, 4, -8, 16, -32, 64, -128, 256, -512]
An interactive test page is available at js/test.html.
Sexydecimal is released to the public domain on April 9, 2026 by Colin M. Saunders.