Learn
The binary blog
Plain guides to binary, hex, text encoding and file sizes. Each one links to the tool that does the math.
Featured · Binary basicsMSB and LSB: most and least significant bits, signed integers and overflow
The MSB is the leftmost, highest-value bit and the LSB the rightmost. See what each tells you, how signed integers use the MSB as a sign bit, and how integer overflow wraps values around.9 min readLatest guides
ProgrammingThe xxd command: hex dumps on Linux and macOS
Use xxd to read the bytes in any file, get plain hex with -p, turn hex back into binary with -r, patch a byte, print bits, make C arrays and diff binary files.9 min read
Binary basicsFloating point numbers explained: why 0.1 + 0.2 is not 0.3
A floating point number is scientific notation in binary. See why 0.1 + 0.2 is 0.30000000000000004, how precise floats are, float vs double, and how to compare floats and handle money.9 min read
Binary basicsWhat is hexadecimal? The base 16 number system explained
Hexadecimal is base 16, with digits 0 to 9 and A to F. See how place values work, why programmers use hex for bytes, the values worth knowing and how octal compares.7 min read
Binary basicsWhat is Base64? How Base64 encoding works
Base64 writes any data with 64 safe characters. See the bit-by-bit steps, the alphabet, why strings end in = or ==, why the result is a third bigger and where you will meet it.10 min read
ProgrammingBase64 encode and decode in Python, JavaScript, Linux and PowerShell
Base64 one-liners for Python, the browser, Node.js, Linux, macOS and PowerShell, with a command builder and fixes for padding errors, echo newlines, line wrapping and UTF-16.13 min read
ProgrammingPython bitwise operators and XOR, with examples
Python's bitwise operators &, |, ^, ~, << and >> explained bit by bit. XOR for flipping bits, ciphers and logical XOR, masks and flags, shifts, and & versus and.10 min read
ProgrammingPython struct: pack and unpack binary data
The struct module packs Python numbers into bytes and unpacks them again. Format characters, byte order, alignment, a PNG header example, records, IPv4 and the common errors.11 min read
ProgrammingConvert int to binary and hex in Python, and back
Convert integers to binary, hex and octal strings in Python and back again. Padding, removing the 0b prefix, negative numbers in two's complement, text to binary and a cheat sheet.9 min read
ProgrammingPython bytes to string and string to bytes
Convert bytes to a string with decode() and a string to bytes with encode(). Includes a live encoder, the str(b) bug, UnicodeDecodeError fixes, int.to_bytes() and hex.11 min read
ProgrammingPython ord() and chr(): character to number and back
ord() returns the Unicode number of a character and chr() turns a number back into a character. Examples for ASCII, accented letters and emoji, plus the errors and how to fix them.9 min read
Binary basicsUnicode, UTF-8 and ASCII explained
ASCII, Unicode and UTF-8 explained: the 128 ASCII codes, Unicode code points, how UTF-8 stores them in 1 to 4 bytes, UTF-16 compared, and what causes garbled text.8 min read
Binary basicsHalf adder and full adder
Half adder and full adder circuits with truth tables and Boolean equations, a full adder built from two half adders, a 4-bit ripple carry adder you can try, and subtraction with the same circuit.7 min read
Binary basicsBig endian vs little endian
What endianness means, how 0x12345678 sits in memory in each order, which processors and file formats use which, network byte order, hex dumps and code to convert.8 min read
Binary basicsBinary subtraction
How to subtract binary numbers: the four rules, borrowing step by step, the two's complement and one's complement methods, common mistakes and practice problems with answers.7 min read
Binary basicsBoolean algebra explained
Boolean algebra from the start: the three operations, every law in one table, three worked simplifications, truth tables, sum of products, and a calculator that builds the table for you.8 min read
Binary basicsDe Morgan's law explained
Both of De Morgan's laws with a truth table proof, a live checker, step-by-step examples, practice problems, and how the laws work in logic gates and in code.8 min read
Binary basicsLogic gates explained
The 7 basic logic gates with symbols, Boolean expressions and truth tables, a live tester for every gate, and how NAND gates and half adders turn bits into arithmetic.9 min read
Binary basicsPowers of 2
The full powers of 2 chart from 2^0 to 2^64, a calculator for any exponent, and why 256, 1,024 and 65,536 keep showing up in bytes, colors and file sizes.6 min read
Binary basicsWhat is binary code?
Binary code stores numbers, text, colors, sound and programs with only 0 and 1. See how bits and bytes work, why computers chose two digits and what Hello looks like in binary.8 min read
Binary basics