Cysteine proteinase inhibitors (CPIs) are involved in many vital cellular processes such as signalling pathways, apoptosis, immune response and development; however, no CPIs have yet been reported from the housefly Musca domestica. Here we report the isolation and characterization of a housefly CPI gene designated MdCPI. The gene contains an open reading frame of 357 bp encoding a protein of 118 amino acid residues with a putative signal peptide of 17 amino acid residues. Protein alignment demonstrated a high homology to that of Sarcophaga crassipalpis (identity = 51%). Phylogenetic analysis suggested that all CPIs from dipterans, including the housefly, belong to the I25A family and may be descended from a single common ancestor. The gene was expressed in and purified from Escherichia coli. Biochemical studies showed that MdCPI exerts an inhibiting function on papain, which is a classical assay to confirm CPIs. Real-time quantitative PCR and immunolocalization analysis revealed that MdCPI is specifically expressed in haemocytes and fat bodies. It is highly down-regulated in larvae and markedly up-regulated in the pupal stage, suggesting that it may be related to development.