There’s no better way to waste money at a mattress store than to buy a mattress that’s ultimately going to be bad for you.

“The No. 1 thing that everyone has to know about mattresses is that they’re very personal,” says Michael Magnuson, founder of the online mattress guide GoodBed. Factors such as your typical sleep position, weight, firmness preference and whether or not you sleep with a partner determine which mattress will give you a solid night’s sleep. Identify those things about yourself, or try GoodBed’s mattress-finder quiz.

This research may also tell you what types of mattresses you prefer, such as memory foam or pillow-top, and their price range. Don’t worry about exact mattress model names, as they’re often inconsistent from store to store.

There are plenty of opportunities to buy a mattress online, through retailers such as Casper, Tuft & Needle, Helix and many others. Mattresses sold online are typically less expensive than those sold in stores. And most online retailers offer generous trial periods and free returns.

Get the full story at nerdwallet.com.