Skip to main content

binaryConverter — Number Base Converter

CI PyPI version License: MIT GitHub stars

Convert between decimal, binary, hexadecimal and octal — all at once, in one command. Available as a pip-installable Python CLI (numbase) and as a dependency-free Bash script.


✨ Features

  • 🔄 All bases at once — enter a number in any base, see DEC / BIN / HEX / OCT simultaneously
  • 🔍 Auto-detection — prefix-based input: 255, 0b1010, 0xFF, 0o17 (underscores allowed: 1_000)
  • ♾️ Interactive or one-shot — a prompt for quick sessions, or a single command for scripts
  • 📋 Clipboard support — result copied automatically (wl-copy, xclip, xsel or pbcopy), or --no-copy
  • 🔢 Arbitrary precision — the Python version handles numbers of any size
  • 🔇 Script-friendly — plain output when piped or when NO_COLOR is set

📥 Installation

pip install numbase-converter

Bash (no dependencies)

git clone https://github.com/serber1990/binaryConverter.git
./binaryConverter/bash/binaryConverter.sh

🛠 Usage

One-shot mode

numbase 255
numbase 0xFF
numbase 0b11001010
numbase 0o377
  ╭──────────────────╮
  │  DEC  255        │
  │  BIN  1111 1111  │
  │  HEX  FF         │
  │  OCT  377        │
  ╰──────────────────╯

  ✔  Copied (BIN): 11111111

Interactive mode

numbase

Type numbers one after another; q (or Ctrl+D) quits.

Clipboard

By default the most useful counterpart is copied: the decimal value for binary input, the binary value otherwise.

numbase 255 --copy hex     # copies FF
numbase 0xFF --copy dec    # copies 255
numbase 255 --no-copy      # leaves the clipboard alone

🎨 Input formats

Format Example Description
Decimal 255 Plain number (leading zeros are fine)
Binary 0b11111111 Prefix 0b or 0B
Hexadecimal 0xFF Prefix 0x or 0X
Octal 0o377 Prefix 0o or 0O

The Bash version accepts the same formats, both as an argument (binaryConverter.sh 0xFF) and at the prompt. It is limited to 63-bit values (max 9223372036854775807); larger numbers are rejected with a clear error.


🗂 Repository structure

binaryConverter/
├── numbase.py                  Python CLI (pip-installable as numbase)
├── bash/
│   └── binaryConverter.sh      Bash version
├── python/
│   └── binaryConverter.py      Compatibility shim → numbase
└── tests/                      pytest suite (Python + Bash)

🧪 Development

pip install -e ".[dev]"
ruff check .
pytest
shellcheck bash/binaryConverter.sh

See CHANGELOG.md for release notes.


📝 License

MIT — see LICENSE.


💬 Feedback

Open an issue or reach out via GitHub.

🌐 Connect

GitHub

Release files for numbase-converter 2.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for numbase-converter 2.1.0
File Size Uploaded
numbase_converter-2.1.0.tar.gz 8.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for numbase-converter 2.1.0
File Interpreter ABI Platform
numbase_converter-2.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 15.3 kB

Release files / numbase_converter-2.1.0.tar.gz

Download URL numbase_converter-2.1.0.tar.gz
Size 8.5 kB
Tags Source
SHA-256 checksum
How to use checksums
96ac0e57c0972dcb5de442d76621c7e7d3dd2d6b36df628e4cc0cc0d662bd64a
BLAKE2b-256 checksum
How to use checksums
d53b5af5a0ebf653b0bb52293175ec93e0f8e50096c21c749683b7f2c1240880
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.7

Release files / numbase_converter-2.1.0-py3-none-any.whl

Download URL numbase_converter-2.1.0-py3-none-any.whl
Size 6.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
4fff89e2a0ada05a5bf5975af68149d5c782c15883ca928650f9fd1855fb8183
BLAKE2b-256 checksum
How to use checksums
90f1f8b66fd928fb1cd22a47740cc19f85eb0dd53f232ed3adfbf3e78af84556
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.7

Release history Release notifications | RSS feed

This release

2.1.0 This release

2 release files

2.0.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page