Our findings confirm the potential of CDH17 as a target for gastric cancer or other cancers overexpressing CDH17 by using nanobodies and encourage clinical translation of CDH17 nanobody-based targeted imaging and therapy. Here, CDH17 is linked to cancer.