string encoding converter
URLs, base64, hex and bin
- URL-encoding: According to the W3C/HTML standard, GET variables passed along in URLs have to be encoded using URL-encoding. For example, spaces are replaced by %20 and a lot of other characters (colons, slashes, etc.) in a similar fashion as a percentage sign and a numerical. Essentially, this is a simple 1-to-1 encoding that replaces certain special characters with a numerical code and a prefix.
- Base64 encoding: A single binary byte of 8-bit information can hold one of 2^8=256 different symbols. However, a lot of those characters have a special interpretation for plain text content, for example an end-of-line or end-of-text character. Base64 encoding splits an 8-bit binary data string into 6-bit pieces, each of which can be represented as a printable text character (a-z, A-Z, 0-9, +, /). Therefore 3 binary bytes are converted to 4 text characters. This encoding is used whenever binary data has to be included in texts, for example in DataURLs, as binary eMail attachments, etc.
- Hex encoding: An 8-bit byte can be represented as a 2-digit number in base-16, better known as hex, which is represented by the 16 printable characters (0-9, a-f).
- Binary encoding: Binary encoding expresses an 8-bit byte in terms of the eight 1s and 0s that make it up in base-2. This is essentially the natural language that every digital computer uses to represent characters and numericals inside its circuitry.
When the option to include spaces in the encoding is activated, space are added to the encoded string, splitting a base-64 encoded string into 4-character pieces (representing 3 bytes), a hex-encoded string into 2-character pieces (representing 1 byte) and a binary string into 8-character pieces (representing 1 byte).