Background: The function of olfactomedin-like 2B (OLFML2B), as a member of the olfactomedin domain-containing protein family, remains ambiguous, especially in tumors. The current study explores the possible correlation between OLFML2B, prognosis, and immune infiltration in pan-cancer.Methods: We applied a number of bioinformatics techniques to probe the prospective function of OLFML2B, consisting of its association with prognosis, clinicopathology, alteration, GSEA, tumor microenvironment (TME), immune-associated genes, immune infiltration, tumor mutational burden (TMB), microsatellite instability (MSI), and drug sensitivity in several cancer types. qPCR and immunohistochemistry were used to identify OLFML2B expression in LIHC cell lines and liver cancer tissues.Results: We discovered that OLFML2B was overexpressed in 14 cancers and positively related to several cancer type prognoses. The expression of OLFML2B was further validated in the LIHC cell lines. OLFML2B expression was bound up with TMB in 13 cancers, MSI in 10 cancers, and TME in almost all cancers. Furthermore, OLFML2B was highly co-expressed with genes encoding immune activators and immune suppressors. We further found that OLFML2B played a role in infiltrating different types of immune cells, such as macrophages and cancer-associated fibroblasts. OLFML2B may influence various cancer and immune-related pathways, such as the PI3K-Akt signaling pathway, ECM–receptor interaction, focal adhesion, and leukocyte transendothelial migration. In addition, OLFML2B may increase drug resistance of binimetinib, cobimentinib, and trametinib.Conclusion: Our outcomes reveal that OLFML2B may act as a prognostic marker and a potential target in immunotherapy for diverse tumors due to its oncogenesis function and immune infiltration.