A sophisticated C++ binary conversion utility that supports bidirectional conversion between binary and various data formats including decimal numbers, hexadecimal, octal, IP addresses (IPv4 and IPv6), text, offsets, and more.
- Decimal ↔ Binary: Convert decimal numbers to binary representation and vice versa
- Hexadecimal ↔ Binary: Convert hexadecimal values (with or without 0x prefix)
- Octal ↔ Binary: Convert octal representations to and from binary
- Custom bit width: Specify custom bit widths for conversions
- IPv4 ↔ Binary: Convert IPv4 addresses (e.g., 192.168.1.1) to 32-bit binary
- IPv6 ↔ Binary: Convert IPv6 addresses to 128-bit binary representation
- Auto-validation: Built-in validation for proper IP address formats
- Text ↔ Binary: Convert ASCII text to binary representation (UTF-8 compatible)
- Byte output: Display binary data as hexadecimal byte representations
- Offset → Binary: Convert memory offsets and addresses (hex or decimal format)
- Binary → Offset: Convert binary back to offset notation (hex format with 0x prefix)
- Binary formatting: Format binary strings with custom group sizes and separators
- Binary to bytes: Convert binary strings to byte arrays
- Interactive menu: Easy-to-use console interface with 16 different conversion options
- Visual Studio 2017 or later
- Windows SDK 10.0
- C++ compiler supporting C++11 or later
- Open
BinaryConvert.slnin Visual Studio - Select your desired build configuration (Debug/Release) and platform (x86/x64)
- Build the solution (Build → Build Solution or press F7)
- Run the executable from the output directory
Alternatively, you can build from the command line:
msbuild BinaryConvert.sln /p:Configuration=Release /p:Platform=x64Simply run the executable to access the interactive menu:
BinaryConvert.exe
- Decimal to Binary - Convert decimal numbers to binary (e.g., 255 → 11111111)
- Binary to Decimal - Convert binary strings to decimal numbers
- Hexadecimal to Binary - Convert hex values (with or without 0x prefix)
- Binary to Hexadecimal - Convert binary to hex format
- Octal to Binary - Convert octal numbers to binary
- Binary to Octal - Convert binary to octal format
- IPv4 Address to Binary - Convert IPv4 addresses to binary
- Binary to IPv4 Address - Convert 32-bit binary to IPv4
- IPv6 Address to Binary - Convert IPv6 addresses to binary
- Binary to IPv6 Address - Convert 128-bit binary to IPv6
- Text to Binary - Convert text strings to binary
- Binary to Text - Convert binary strings to text
- Offset/Address to Binary - Convert offsets to binary
- Binary to Offset/Address - Convert binary to hex offset notation
- Format Binary String - Format binary with custom grouping
- Binary to Bytes - Display binary as hexadecimal bytes
Input: 255
Bit width: 8
Output: 11111111
Input: 192.168.1.1
Output: 11000000.10101000.00000001.00000001
Input: Hello
Output: 01001000 01100101 01101100 01101100 01101111
Input: 0x400
Output: 010000000000
BinaryConvert/
├── BinaryConvert.sln # Visual Studio solution file
├── BinaryConvert.vcxproj # Visual Studio project file
├── BinaryConverter.h # Header file with class interface
├── BinaryConverter.cpp # Implementation of conversion logic
├── main.cpp # Main entry point with interactive menu
└── README.md # This file
The core functionality is provided by the BinaryConverter class with static methods for all conversions:
- All methods include validation and error handling
- Input sanitization removes whitespace automatically
- Support for common prefixes (0x for hex, 0 for octal)
- Proper handling of negative numbers using two's complement
- IPv6 addresses support compressed notation (::)
All conversion methods include comprehensive error handling with descriptive error messages for:
- Invalid input formats
- Out-of-range values
- Malformed IP addresses
- Invalid binary strings
- All conversions are case-insensitive where applicable
- Binary strings can include or exclude whitespace (automatically stripped)
- IP address validation follows RFC standards
- The tool handles both signed and unsigned integer representations
This project is provided as-is for educational and professional use.