Read More | Important Notice |
This page allows you to convert between 3 different representations of data:
Text | |
Hexadecimal | |
Base64 |
f09f9a82 Train in Hexadecimal Unicode.
Text: Ordinary text is usually represented in the Unicode UTF-8 format. That means that every caracter in every living, plus the most common dead, languages can be represented as a group of 1, 2, 3, or 4 eight-bit bytes. US-ASCII is a strict subset of this code, and each US-ASCII character is encoded using only one byte. Use the upper box in the section above for Unicode or US-ASCII text.
Hexadecimal code represents each 8-bit byte as two Hexadecimal (4-bit) code symbols. The name "Hexadecimal" implies use of an underlying base-16 encoding, as opposed to our standard Arabic number system, which is base-10. Hexadecimal is intended to be human-readable, in that the underlying bit patterns can be easily read by humans, at least after a few minutes of training.
The reason for using hexadecimal coding is in order to transport special symbols, pictures, movies, or other items over media (such as email) which were intended to carry only ordinary text with english letters. Hexadecimal coding of such data allows it to be carried over such links and to be decoded properly at the destination. Hexadecimal uses only Arabic digits (0 - 1) and lower-case letters (a - f) to represent the 16 posible values. Two Hexadecimal digits (themselves each represented as two 8-bit text bytes) represent one 8-bit byte, so in a sense the "efficiency" of Hexadecimal is 50% - two bytes, each representing one Hexadecimal character, per payload or data byte.
The binary value vs the Hexadecimal code is as follows:
Value | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Hex | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | a | b | c | d | e | f |
Base64: The purpose of Base64 is to transport unrestricted data bytes with greater efficiency than can be achieved with Hexadecimal encoding. Base 64 uses 65 (not 64) US-ASCII symbols so that 6 bits can be sent with each byte of the code, rather than 4 bits as with Hexadecimal. The Base64 coding efficiency is 6 bits of data per 8-bit byte, for an average efficiency of 6/8 or 75%. Base64 is not intended to be human-readable, although somebody somewhere will prove me wrong on this.
There are many variants of Base64. The variant used for MIME email attachments is the one used for this page. Because each byte can carry only 6 bits of data Base64 is applied to groups of 3 bytes to give 4 Base64 characters. This creates a small problem for data which does not consist of a multiple of 3 bytes (24 bits). When (always at the end of a message) there is a number of bytes of data less than 3 to be encoded, the 65th character "=" is used to indicate that there are fewer than 3 bytes of data. In these cases any "missing" bits in the data due to the missing bytes are encoded as all zeros, and the trailing Base64 characters are replaced by "=". Thus a single letter "a" would be encoded as "YQ==" and "aa" would be encoded as "YWE=". "aaa" would of course be encoded as "YWFh", as the 3 "a" characters fill the total block.
The binary value vs the Base64 code is as follows:
Value | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Base64 | A | B | C | D | E | F | G | H | I | J | K | L | M | N | O | P |
Value | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 |
Base64 | Q | R | S | T | U | V | W | X | Y | Z | a | b | c | d | e | f |
Value | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 |
Base64 | g | h | i | j | k | l | m | n | o | p | q | r | s | t | u | v |
Value | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 |
Base64 | w | x | y | z | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | + | / |
€ = e282ac
Ω = cea9
ecmanaut: Encoding / Decoding UTF8 in JavaScript
UTF-8 in JavaScript - monsur.hossa.in
My only reward for writing this is the 15 milliseconds of fame I receive from having my name here. Don't deprive me of that.
You can copy this page by simply doing a "Save As" in your browser and putting it somewhere on your hard drive (or your web site). If you stop there the background will be gone. To preserve the background, copy the following file into this same folder, without changing its name, by again using your browser's "Save As". The next time you refresh the page, the background should be restored:
I make NO guarantee of any kind.
This page may contain serious errors.
Use this page entirely at your own risk!
This page is for entertainment purposes only.