I have read that there is a 6-bit character encoding and was wondering if having a 5-bit encoding would be useful or considered an improvement in some cases.

I think I have found a way of achieving that, have just to write the relative code to encode/decode the text from 8-bit to 5-bit and vice versa.

  • 1
    Are you trying to re-discover Base64?
    – harrymc
    May 21 '19 at 20:13
  • @harrymc: I suspect OP specifically means text encodings, and although Base64 is 6-bit, it doesn't directly encode text the same way that e.g. Baudot encodes text – it's merely a mapping of 3x8-bit bytes to 4x6-bit.
    – user1686
    May 21 '19 at 21:11

The old Baudot code used with teletype used 5 data bits. It allowed sending and receiving text over a telegraph system and printing on a device similar to a typewriter. It was first introduced in the 1840's and was still in common use in the 1970's. For serial communication 2 start bits and an end bit were added.

A 5 bit code only provided 32 combinations. To support the alphabetic characters plus numbers and symbols 2 modes were used. The letter mode had the alphabet while the figures mode had numbers and symbols. Characters for space, carriage return, line feed and switching modes were common to both. Lower case characters were not supported.

The 5 bit code was used because it was simple to implement in a mechanical device and it made efficient use of a slow transmission system. It's usefulness is questionable in current times but it might be useful for very special purposes. But any advantages would have to be carefully weighed against the limitations.


Yes, a 5-bit encoding is useful in some cases. Especially, in constrained environments, just think of old gaming hardware (e.g. NES) or data-transfer over network.

When the character set is small, strings could be encoded in a bitstream that packs 5 bits per character rather than 8 bits per character. This results in a reduction of data size. You are compressing data by using a fixed bit-length encoding. Of course, you are trading "compressed data" against "more processing speed" due to the need to "encode/decode".

Using 5 bits allows the data to have values in the range 0-31 ($00-$1F). You can only represent 32 items. By using paging/modes you can extend the number of supported items. Think of, e.g. 3 pages with 32 chars + 32 chars + 32 control commands.

As said, this is a fixed bit-length encoding. The follow up topics are variable bit-length encoding, then followed by Huffman encoding (for optimizing the encoding by doing a item frequency/occurrence analysis).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.