The relative synonymous codon use frequency of 135 MHC genes from four mammal species (Homo sapiens, Pan troglodyte, Macaca mulanta and Rattus norvegicus) is analyzed using a hierarchical cluster method. The result suggests that gene function is the dominant factor that determines codon usage bias, while species is a minor factor that determines further difference in codon usage bias for genes with similar functions. The conclusion may be useful in gene classification and gene function prediction.