What is the most compact way to store the sentence The quick brown fox jumps over the lazy dog without losing data?

Whatever way you think of must be explained and the process should be reversible.

I am not looking for a small way to store on a computer but for writing on paper.

  • 1
    $\begingroup$ I'm voting to close this question as off-topic because this is a question about data compression algorithms and answers to such topics can be found on StackOverflow. $\endgroup$ – CodeNewbie Aug 18 '15 at 12:20
  • $\begingroup$ Is this an acceptable solution? :-) pastee.org/52aun $\endgroup$ – Carl Löndahl Aug 18 '15 at 12:21
  • 2
    $\begingroup$ Does everyone have to recognize the encoded form without agreeing on an algorithm beforehand? How do you judge the 'most compact' on paper? Size? Length? Number of different symbols? What stops me from arbitrarily defining a symbol as 'The quick brown fox jumps over the lazy dog'? Voting to close as unclear. $\endgroup$ – Tryth Aug 18 '15 at 12:34
  • 1
    $\begingroup$ @AgeDeO You still really haven't addressed my questions. How do you judge 'most compact'? What stops me from defining a symbol for every word in the English language? Or a symbol for every combination of 43 characters from the alphabet and spaces? $\endgroup$ – Tryth Aug 18 '15 at 12:44
  • 1
    $\begingroup$ You also have to specify what constitutes a valid compression algorithm. If you allow dictionary based compressions, you can put all the information into the dictionary and compress your sentence into T or whatever. $\endgroup$ – Cephalopod Aug 18 '15 at 12:56

Each letter is one of 26 separate characters. We could use a base-32 (2^5) storage format to store the numbers in binary. a would be 00001, b would be 00010, etc. This is assuming that you don't care about capitalization, which would double the required space.

The algorithm would require 43 characters of code for the entire sentence because some letters are duplicated. 43 * 5 = 215 bits, or just under 27 bytes.

To decrypt it we would simply grab 5 characters at a time and add the relevant values to their binary value to get their ascii codes.

Sorry, something's preventing me from using spoiler tags here.

| improve this answer | |
  • $\begingroup$ Changing one letter into 5 digits does not make the sentence smaller it makes it 5 times as big. I am not looking for a small way to store on a computer but for writing on paper. $\endgroup$ – AgeDeO Aug 18 '15 at 12:29
  • 1
    $\begingroup$ ooOOOhhh... Wow, I kinda defaulted to programmer mode, sorry. $\endgroup$ – Kingrames Aug 18 '15 at 12:31
  • $\begingroup$ no, Kingrames is correct. Instead of using one byte (8 bits) to encode each letter, he's using 5 bits, which would reduce the size. $\endgroup$ – dfperry Aug 18 '15 at 13:24

Solution : change the base !


If you take each word as a number in base 26 (a=1, b=2 etc) you have a number. For example :

the = 20*26²+8*26+5=13733 (t=20, h=8 and e=5)<br>

Then you change the base. You can take base 255 (each value is an ascii character) and convert the number :

13733 = 53*255+218

You can convert your new numbers in ascii (base 255), and you get


You saves one character here, yayy !


To decrypt the message you basically do the same thing reversed (from base 255 to base 26).

Edit :
I did it for the whole sentence and I found this : 5┌ }=☺ ‼§‗ ◄ç L↑; ♦A═ 5┌ ♥Cü ♀). It saves 12 characters.

Old answer

I can apply a small optimization by removing spaces.


Every new word start with a upper-cased letter

| improve this answer | |
  • $\begingroup$ Note : the bigger your base is, the fewer character you will have ! $\endgroup$ – The random guy Aug 18 '15 at 14:18

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