Adult somatic tissues have proven difficult to expand in vitro, largely because of the complexity of recreating appropriate environmental signals in culture. We have overcome this problem recently and developed culture conditions for adult stem cells that allow the long-term expansion of adult primary tissues from small intestine, stomach, liver and pancreas into self-assembling 3D structures that we have termed 'organoids'. We provide a detailed protocol that describes how to grow adult mouse and human liver and pancreas organoids, from cell isolation and long-term expansion to genetic manipulation in vitro. Liver and pancreas cells grow in a gel-based extracellular matrix (ECM) and a defined medium. The cells can self-organize into organoids that self-renew in vitro while retaining their tissue-of-origin commitment, genetic stability and potential to differentiate into functional cells in vitro (hepatocytes) and in vivo (hepatocytes and endocrine cells). Genetic modification of these organoids opens up avenues for the manipulation of adult stem cells in vitro, which could facilitate the study of human biology and allow gene correction for regenerative medicine purposes. The complete protocol takes 1-4 weeks to generate self-renewing 3D organoids and to perform genetic manipulation experiments. Personnel with basic scientific training can conduct this protocol.