The generation of insulin-producing pancreatic β cells from stem cells in vitro would provide an unprecedented cell source for drug discovery and cell transplantation therapy in diabetes. However, insulin-producing cells previously generated from human pluripotent stem cells (hPSC) lack many functional characteristics of bona fide β cells. Here, we report a scalable differentiation protocol that can generate hundreds of millions of glucose-responsive β cells from hPSC in vitro. These stem-cell-derived β cells (SC-β) express markers found in mature β cells, flux Ca2+ in response to glucose, package insulin into secretory granules, and secrete quantities of insulin comparable to adult β cells in response to multiple sequential glucose challenges in vitro. Furthermore, these cells secrete human insulin into the serum of mice shortly after transplantation in a glucose-regulated manner, and transplantation of these cells ameliorates hyperglycemia in diabetic mice.