# Number Base Converter Convert integers between any bases 2-36. Zero dependencies (pure stdlib). ``` python scripts/run.py ff --from-base 16 --to-base 10 python scripts/run.py 255 --to-base 2 python scripts/run.py 1010 --from-base 2 --to-base 16 --prefix python scripts/run.py 255 --all echo "10 20 30" | python scripts/run.py - --to-base 16 ``` Supports an optional sign, `_` separators, and 0x/0o/0b prefixes on input. --- name: number-base-converter display_name: Number Base Converter description: "Convert integers between binary, octal, decimal, hex and any base 2-36. Use to change a number's radix or see all common bases at once. Triggers: convert base, hex to decimal, binary to hex, radix, base 2 to base 16." --- # Number Base Converter Convert integers between arbitrary bases (2-36) from chat. ## When to use The user has a number in one base and wants it in another — hex to decimal, binary to hex, decimal to base-36, etc. — or wants to see binary/octal/decimal/hex all at once. ## How to use Run `scripts/run.py` with the number plus `--from-base`/`--to-base`: - `python scripts/run.py ff --from-base 16 --to-base 10` — hex `ff` to decimal. - `python scripts/run.py 255 --to-base 2` — decimal 255 to binary. - `python scripts/run.py 1010 --from-base 2 --to-base 16 --prefix` — binary to `0xa`. - `python scripts/run.py 255 --all` — show bin/oct/dec/hex. - `echo "10 20 30" | python scripts/run.py - --to-base 16` — convert many via stdin. Default from-base is 10, default to-base is 16. Underscores and 0x/0o/0b prefixes in input are tolerated. ## Pitfalls - Integers only — no fractions or floats. - Digits must be valid for the input base (e.g. `2` is invalid in base 2); invalid digits exit 1. - Bases outside 2..36 exit 2.
Number Base Converter by langbot-team
Convert integers between binary, octal, decimal, hex and any base 2-36.
Loading...