This study revealed the potential pathogenic role of KLF4 in IPF and successfully constructed diagnostic and prognostic models. Here, KLF4 is linked to idiopathic pulmonary fibrosis.