The invention provides a method for compressing or decompressing name data, and equipment thereof, wherein the method comprises the steps of: for aiming at a preset name database which comprises a plurality of name data, generating a compressed character string set which covers all name data in the name database, wherein the character strings in the compressed character string set are generated based on total or partial characters of each name data; according to the frequency of the character strings in the compressed character string set, establishing a Huffman tree which corresponds with the compressed character string set, and generating a compression code table which comprises compression codes of all character strings in the compressed character string set; and in performing compression coding on one name datum, according to the character string contained in the name datum, obtaining the compression code which corresponds with each character string from the compression code table, and obtaining the compression codes of the name datum through combination. The method of the invention can improve compressing/decompressing efficiency for the name data.