There are notions of L2-Betti numbers for discrete groups (Cheeger–Gromov, Lück), for type II1-factors (recent work of Connes-Shlyakhtenko) and for countable standard equivalence relations (Gaboriau). Whereas the first two are algebraically defined using Lück's dimension theory, Gaboriau's definition of the latter is inspired by the work of Cheeger and Gromov. In this work we give a definition of L2-Betti numbers of discrete measured groupoids that is based on Lück's dimension theory, thereby encompassing the cases of groups, equivalence relations and holonomy groupoids with an invariant measure for a complete transversal. We show that with our definition, like with Gaboriau's, the L2-Betti numbers [Formula: see text] of a countable group G coincide with the L2-Betti numbers [Formula: see text] of the orbit equivalence relation [Formula: see text] of a free action of G on a probability space. This yields a new proof of the fact the L2-Betti numbers of groups with orbit equivalent actions coincide.