An encoding device(100a) generates static-encoded data from input text data, utilizing a static dictionary that associates a character strings and static codes, respectively the static-encoded data including a plurality of static codes corresponding to a plurality of character strings that are registered in the static dictionary, generates dynamic-encoded data from the static-encoded data by encoding a character string or the static code that occurs more than once in the static-encodes data into a dynamic code, creates a dynamic dictionary associating character strings or static codes with corresponding dynamic codes, respectively and creates a Huffman tree and data of a leaf in the Huffman tree based on an occurrence frequency of the dynamic codes and the static codes in the input text data.