devShakib

Loading devShakib…

Base Converter

Convert integers between binary, octal, decimal, hex and any base 2–36.

Positional notation is one idea with different radixes, and the useful bases are useful for concrete reasons. Hex is compact and maps cleanly to bytes, since two hex digits are exactly eight bits. Octal survives mainly because Unix permissions come in threes. Binary is where you go when a single bit is the question.

Bases above 16 borrow letters and get used for making identifiers short — base 32 and base 36 turn a long integer into a few characters for a URL. Be careful reading those back: base 36 is case-insensitive by convention but not by definition, and a system that treats `A` and `a` as different values will disagree with one that does not.