A Python library to convert numbers across the world's numeral systems.
pip install numly
numly lets you convert any number between 12 different numeral systems with a single function call β from ancient Egyptian hieroglyphs to modern binary, from Mayan glyphs to English words.
import numly
numly.convert(42, "decimal", "roman") # β 'XLII'
numly.convert("XLII", "roman", "chinese") # β 'εεδΊ'
numly.to_words(1_234_567, "indian") # β 'twelve lakh thirty four thousand...'
numly.to_binary(255) # β '11111111'
numly.to_all(42) # β all systems at once| System | Example (42) | Range |
|---|---|---|
decimal |
42 |
0 β unlimited |
roman |
XLII |
1 β 3,999 |
arabic_indic |
Ω€Ω’ |
0 β unlimited |
chinese |
εεδΊ |
0 β 99,999,999 |
greek |
ΞΞΚΉ |
1 β 9,999 |
egyptian |
πππππΊπΊ |
1 β 9,999,999 |
tamil |
ΰ―ͺΰ―°ΰ―¨ |
0 β 9,999 |
babylonian |
πππππΉπΉ |
1 β 216,000 (base 60) |
mayan |
π π |
0 β 7,999 (base 20) |
binary |
101010 |
0 β unlimited |
octal |
52 |
0 β unlimited |
hex |
2A |
0 β unlimited |
words |
forty two |
0 β 999 trillion |
Systems with a range limit return
Noneinto_all()if the number is out of range.
pip install numlyRequires Python 3.8 or higher.
import numly
# Numeral systems
numly.to_roman(2024) # β 'MMXXIV'
numly.to_chinese(42) # β 'εεδΊ'
numly.to_arabic_indic(2024) # β 'Ω’Ω Ω’Ω€'
numly.to_greek(999) # β 'Ο ΟΞΚΉ'
numly.to_egyptian(1234) # β 'πΌπ’π’ππππΊπΊπΊπΊ'
numly.to_tamil(42) # β 'ΰ―ͺΰ―°ΰ―¨'
numly.to_babylonian(61) # β 'πΉ πΉ'
numly.to_mayan(42) # β 'π π'
numly.to_mayan_text(42) # β 'β’β’ | β’β’'
# Base conversions
numly.to_binary(42) # β '101010'
numly.to_octal(42) # β '52'
numly.to_hex(255) # β 'FF'
numly.to_hex(255, prefix=True) # β '0xFF'
numly.to_base(42, 36) # β '16'
# English words
numly.to_words(1_234_567) # β 'one million two hundred thirty four thousand five hundred sixty seven'
numly.to_words(1_234_567, "indian") # β 'twelve lakh thirty four thousand five hundred sixty seven'
# Convert back to decimal
numly.from_roman('MMXXIV') # β 2024
numly.from_chinese('εεδΊ') # β 42
numly.from_tamil('ΰ―ͺΰ―°ΰ―¨') # β 42
numly.from_babylonian('πΉ πΉ') # β 61
numly.from_mayan('π π') # β 42
numly.from_binary('101010') # β 42
numly.from_hex('FF') # β 255Convert between any two systems directly β no need to go through decimal.
from numly import convert
# decimal β others
convert(42, "decimal", "roman") # β 'XLII'
convert(42, "decimal", "tamil") # β 'ΰ―ͺΰ―°ΰ―¨'
convert(42, "decimal", "babylonian") # β 'πππππΉπΉ'
convert(42, "decimal", "mayan") # β 'π π'
convert(42, "decimal", "binary") # β '101010'
convert(42, "decimal", "hex") # β '2A'
# cross-system (no decimal step needed)
convert("MMXXIV", "roman", "chinese") # β 'δΊειΆδΊεε'
convert("εεδΊ", "chinese", "greek") # β 'ΞΞΚΉ'
convert("ΞΞΚΉ", "greek", "roman") # β 'XLII'
convert("Ω€Ω’", "arabic_indic", "egyptian") # β 'πππππΊπΊ'
convert("101010", "binary", "hex") # β '2A'
# to decimal
convert("XLII", "roman", "decimal") # β 42
convert("FF", "hex", "decimal") # β 255Convert a number to all systems at once.
from numly import to_all
to_all(42)
# {
# 'decimal': 42,
# 'roman': 'XLII',
# 'arabic_indic': 'Ω€Ω’',
# 'chinese': 'εεδΊ',
# 'greek': 'ΞΞΚΉ',
# 'egyptian': 'πππππΊπΊ',
# 'tamil': 'ΰ―ͺΰ―°ΰ―¨',
# 'babylonian': 'πππππΉπΉ',
# 'mayan': 'π π',
# 'binary': '101010',
# 'octal': '52',
# 'hex': '2A'
# }Convert numbers to English words in Western or Indian system.
from numly import to_words, to_words_western, to_words_indian
# Western system (thousand β million β billion β trillion)
to_words_western(0) # β 'zero'
to_words_western(42) # β 'forty two'
to_words_western(1_000) # β 'one thousand'
to_words_western(1_000_000) # β 'one million'
to_words_western(1_234_567) # β 'one million two hundred thirty four thousand five hundred sixty seven'
to_words_western(1_000_000_000) # β 'one billion'
# Indian system (thousand β lakh β crore)
to_words_indian(0) # β 'zero'
to_words_indian(42) # β 'forty two'
to_words_indian(1_00_000) # β 'one lakh'
to_words_indian(1_234_567) # β 'twelve lakh thirty four thousand five hundred sixty seven'
to_words_indian(1_00_00_000) # β 'one crore'
to_words_indian(1_00_00_00_000) # β 'ten crore'
# or use to_words() with system parameter
to_words(1_234_567, "western") # β 'one million two hundred...'
to_words(1_234_567, "indian") # β 'twelve lakh thirty four thousand...'from numly import to_binary, to_octal, to_hex, to_base
# Binary
to_binary(42) # β '101010'
to_binary(42, prefix=True) # β '0b101010'
from_binary('101010') # β 42
# Octal
to_octal(42) # β '52'
to_octal(42, prefix=True) # β '0o52'
from_octal('52') # β 42
# Hexadecimal
to_hex(255) # β 'FF'
to_hex(255, prefix=True) # β '0xFF'
to_hex(255, upper=False) # β 'ff'
from_hex('FF') # β 255
from_hex('0xff') # β 255
# Any custom base (2β36)
to_base(42, 2) # β '101010'
to_base(42, 8) # β '52'
to_base(42, 16) # β '2A'
to_base(255, 36) # β '73'
from_base('2A', 16) # β 42Ancient Tamil positional-additive system using Unicode Tamil block.
numly.to_tamil(0) # β 'ΰ―¦'
numly.to_tamil(10) # β 'ΰ―°'
numly.to_tamil(42) # β 'ΰ―ͺΰ―°ΰ―¨'
numly.to_tamil(1234) # β 'ΰ―§ΰ―²ΰ―¨ΰ―±ΰ―©ΰ―°ΰ―ͺ'
numly.from_tamil('ΰ―ͺΰ―°ΰ―¨') # β 42Base-60 cuneiform system using πΉ (1) and π (10). Digits separated by spaces.
numly.to_babylonian(10) # β 'π'
numly.to_babylonian(42) # β 'πππππΉπΉ'
numly.to_babylonian(60) # β 'πΉ π±' (1Γ60 + zero)
numly.to_babylonian(61) # β 'πΉ πΉ' (1Γ60 + 1)
numly.to_babylonian(3661) # β 'πΉ πΉ πΉ' (1Γ3600 + 1Γ60 + 1)
numly.from_babylonian('πΉ πΉ') # β 61Base-20 system β one of the first civilisations to use zero. Available in Unicode glyph form and human-readable dot/bar form.
numly.to_mayan(0) # β 'π '
numly.to_mayan(19) # β 'π³'
numly.to_mayan(20) # β 'π‘ π ' (1Γ20 + 0)
numly.to_mayan(42) # β 'π π' (2Γ20 + 2)
numly.to_mayan_text(0) # β 'β' (shell = zero)
numly.to_mayan_text(7) # β 'β’β’β' (2 dots + 1 bar)
numly.to_mayan_text(42) # β 'β’β’ | β’β’'
numly.from_mayan('π π') # β 42Each system has an is_valid_* function:
numly.is_valid_roman("XIV") # β True
numly.is_valid_roman("ABC") # β False
numly.is_valid_chinese("εεδΊ") # β True
numly.is_valid_greek("ΞΞΚΉ") # β True
numly.is_valid_egyptian("πππΊπΊ") # β True
numly.is_valid_arabic_indic("Ω€Ω’") # β True
numly.is_valid_tamil("ΰ―ͺΰ―°ΰ―¨") # β True
numly.is_valid_babylonian("πΉ πΉ") # β True
numly.is_valid_mayan("π π") # β Truefrom numly import symbol_breakdown
symbol_breakdown(1234)
# {'πΌ': 1, 'π’': 2, 'π': 3, 'πΊ': 4}
# 1 lotus (1000) + 2 rope coils (100) + 3 heel bones (10) + 4 tallies (1)numly raises clear, descriptive errors:
numly.to_roman(5000)
# ValueError: Roman numerals support 1β3999, got 5000
numly.to_roman("hello")
# TypeError: Expected int, got 'str'
numly.from_roman("XYZ")
# ValueError: Invalid Roman numeral character: 'Y'
numly.to_binary(-1)
# ValueError: Negative numbers are not supported
numly.to_words(42, "french")
# ValueError: Unknown system 'french'. Choose 'western' or 'indian'.| Function | Input | Output |
|---|---|---|
to_roman(n) / from_roman(s) |
int / str |
str / int |
to_arabic_indic(n) / from_arabic_indic(s) |
int / str |
str / int |
to_chinese(n) / from_chinese(s) |
int / str |
str / int |
to_greek(n) / from_greek(s) |
int / str |
str / int |
to_egyptian(n) / from_egyptian(s) |
int / str |
str / int |
to_tamil(n) / from_tamil(s) |
int / str |
str / int |
to_babylonian(n) / from_babylonian(s) |
int / str |
str / int |
to_mayan(n) / from_mayan(s) |
int / str |
str / int |
to_mayan_text(n) |
int |
str (dots & bars) |
symbol_breakdown(n) |
int |
dict |
| Function | Input | Output |
|---|---|---|
to_binary(n, prefix) / from_binary(s) |
int / str |
str / int |
to_octal(n, prefix) / from_octal(s) |
int / str |
str / int |
to_hex(n, prefix, upper) / from_hex(s) |
int / str |
str / int |
to_base(n, base) / from_base(s, base) |
int / str |
str / int |
| Function | Input | Output |
|---|---|---|
to_words(n, system) |
int, 'western'/'indian' |
str |
to_words_western(n) |
int |
str |
to_words_indian(n) |
int |
str |
| Function | Input | Output |
|---|---|---|
convert(value, from, to) |
any |
str / int |
to_all(value, from) |
any |
dict |
supported_systems() |
β | list |
- π Negative number support
- π Locale-aware formatting (
1,000.00vs1.000,00) - π Words in more languages (Tamil, Hindi, Arabicβ¦)
- π Numbers beyond current range limits
- π More ancient systems (Aztec, Sumerian, Greek acrophonic)
Contributions are welcome! Feel free to open an issue or submit a pull request.
git clone https://github.com/TheMadrasTechie/numly.git
cd numly
pip install -e .MIT License Β© 2026 TheMadrasTechie