When you're retired, you may want to spend more time with your grandkids, work on a favorite hobby, travel, volunteer, or spend more time exercising or being in the outdoors. Will you live closer to family, or somewhere you can enjoy mild weather year round?

Some people may move when they retire, others may stay where they are. Whether you stay or go, how does each state hold up when it comes to a quality, affordable retirement?

In deciding where to retire, most retirees value proximity to family and friends, affordable cost of living, access to excellent health care and hospitals, good weather and a low crime rate, according to a 2018 survey by the Transamerica Center for Retirement Studies.

To find the best and worst states to retire, personal finance site Bankrate looked at 11 public and private datasets and scored each state in five categories: Affordability was 40% of the score, crime was 5%, culture 15%, weather was 15% and wellness was 25% of the score. Here's how each of the 50 states ranked overall, and in each category individually.