Learn to Code ยท zero-dependency ยท MIT

larzbase

Convert number bases and see why.

Understanding binary and hex is a coder's rite of passage, usually taught as magic. larzbase converts between any bases (2-36) AND explains the conversion with place values - 101010 binary visibly becomes 1x32 + 1x8 + 1x2 = 42.

larzscript pkg install base
View on GitHub →Learn the stack

What you get

Try it

import "base" as numbase
print(numbase.to_base(255, 16))
print(numbase.to_base(255, 2))
print(numbase.from_base("ff", 16))
print(numbase.to_hex(255))
Output
ff
11111111
255
ff

Why it's in the Larz Stack

larzbase is a real Larzscript package (larzscript pkg install base) - money-native, zero dependencies, the same language as the rest of the estate, not a separate Python runtime. It composes with the rest of the Larz Stack and the Larz framework.