The formula existing in the literature for the ADM mass of 2D dilaton gravity is incomplete. For example, in the case of an infalling matter shockwave this formula fails to give a time-independent mass, unless a very special coordinate system is chosen. We carefully carry out the canonical formulation of 2D dilaton gravity theories (classical, CGHS and RST). As in 4D general relativity one must add a boundary term to the bulk Hamiltonian to obtain a well-defined variational problem. This boundary term coincides with the numerical value of the Hamiltonian and gives the correct mass which obviously is time-independent.