Explant culture data have suggested that the liver and pancreas originate from common progenitors. We used single-cell-lineage tracing in zebrafish to investigate this question in vivo as well as to analyze the hepatic versus pancreatic fate decision. At early somite stages, endodermal cells located at least two cells away from the midline can give rise to both liver and pancreas. In contrast, endodermal cells closer to the midline give rise to pancreas and intestine, but not liver. Loss- and gain-of-function analyses show that Bmp2b, expressed in the lateral plate mesoderm, signals through Alk8 to induce endodermal cells to become liver. When Bmp2b was overexpressed, medially located endodermal cells, fated to become pancreas and intestine, contributed to the liver. These data provide in vivo evidence for the existence of bipotential hepatopancreatic progenitors and indicate that their fate is regulated by the medio-lateral patterning of the endodermal sheet, a process controlled by Bmp2b.