Using a tape measure or ruler measure the width and length. Where it gets tricky is the depth. Measure from the bottom, where it rests on the box spring, to the top of the mattress.
If you have a pillowtop mattress or topper, a memory foam pad, or other mattress pad that you want to encase along with your mattress, include this in the total height measurement.
For more information please read - How to Measure a Mattress for a Mattress Cover (and Get it Right)