The black soldier fly (BSF), Hermetia illucens, has the potential to serve as a valuable resource for waste bioconversion due to the ability of the larvae to thrive in a microbial-rich environment. Being an ecological decomposer, the survival of BSF larvae (BSFL) relies on developing an efficient defense system. Cathepsin L (CTSL) is a cysteine protease that plays roles in physiological and pathological processes. In this study, the full-length of CTSL was obtained from BSF. The 1,020-bp open reading frame encoded a preprotein of 339 amino acids with a predicted molecular weight of 32 kDa. The pro-domain contained the conserved ERFNIN, GNYD, and GCNGG motifs, which are all characteristic of CTSL. Homology revealed that the deduced amino acid sequence of BSF CTSL shared 74.22-72.99% identity with Diptera flies. Immunohistochemical (IHC) analysis showed the CTSL was predominantly localized in the gut, especially in the midgut. The mRNA expression of CTSL in different larval stages was analyzed by quantitative real-time PCR (RT-qPCR), which revealed that CTSL was expressed in the second to sixth instar, with the highest expression in the fifth instar. Following an immune challenge in vivo using Escherichia coli (E. coli), CTSL mRNA was significantly up-regulated at 6 h post-stimulation. The Z-Phe-Arg-AMC was gradually cleaved by the BSFL extract after 3 h post-stimulation. These results shed light on the potential role of CTSL in the defense mechanism that helps BSFL to survive against pathogens in a microbial-rich environment.