The initial value problems for the Korteweg-de Vries (KdV) and modified KdV (mKdV) equations under periodic and decaying boundary conditions are considered. These initial value problems are shown to be globally well-posed in all -based Sobolev spaces where local well-posedness is presently known, apart from the endpoint for mKdV and the endpoint for KdV. The result for KdV relies on a new method for constructing almost conserved quantities using multilinear harmonic analysis and the available local-in-time theory. Miura’s transformation is used to show that global well-posedness of modified KdV is implied by global well-posedness of the standard KdV equation.