There are a bunch of things it's smart to do before you retire -- such as reading up on Social Security, Medicare, and long-term care insurance in order to be able to make savvy decisions regarding them.

Another critical thing to do before you retire is to make sure you've amassed the sum you need in order to support yourself in retirement. That sum is different for each individual, depending, in part, on your lifestyle, risk tolerance, and even where you live. For many people, a million dollars is a good target.

A smiling farmer.

Image source: Getty Images.

Here are three ways you might earn $1 million before retiring. And for best results, you'll want to act on all of them.

1. Start saving and investing early

To achieve the most powerful growth for your money, you'll want to start saving and investing as early as possible. At age 35, for example, you might not think that retirement saving is that important, but at 35, you might have 30 years before you retire, which is a long period in which your money can grow for you. Consider, for example, that a single $10,000 investment growing at 8% annually becomes $31,720 over 15 years, but over 30 years, it will grow to more than $100,000. Your earliest invested dollars are your most powerful ones.

2. Beef up your income with a side gig

Since you may not have lots of dollars to deploy into stocks right now -- and now is when your dollars have the most time to grow for you -- it's well worth looking into how you might boost your income so you can boost your saving and investing.

Check out the table below, which shows how much you might amass over time saving different sums regularly over various periods. The bolded numbers reflect the point at which you'd have about a million dollars:

Growing at 8% for

$10,000 invested annually

$15,000 invested annually

$20,000 invested annually

5 years

$63,359

$95,039

$126,718

10 years

$156,455

$234,683

$312,910

15 years

$293,243

$439,865

$586,486

20 years

$494,229

$741,344

$988,458

20.5 years

$518,914

$778,371

$1,037,828

23.5 years

$688,744

$1,033,115

$1,377,487

25 years

$789,544

$1,184,316

$1,579,088

28 years

$1,029,659

$1,544,489

$2,059,319

30 years

$1,223,459

$1,835,189

$2,446,918

Source: Calculations by author.

Clearly, the more you can invest, the faster you'll achieve your financial goals. Saving $10,000 annually gets you to a million dollars in around 28 years, but saving $20,000 annually will get you there in only about 20 1/2 years -- 7 1/2 years sooner.

A smiling cashier.

Image source: Getty Images.

It's easier said than done to significantly increase your contributions to your investment accounts. One strategy to help make that happen is to take on a side gig for a few years or many years. If you can find one or two money-making activities you can do on the side that you actually enjoy (or at least don't mind that much), you may be able to keep at it for longer.

As examples, you might do sewing alterations for people, offer handyperson services, babysit, walk dogs, give language or music lessons, or sign up to do tasks for people via sites such as TaskRabbit.com. If you can bring in, say, $200 per week, that's more than $10,000 per year -- a sum that could greatly boost your investment results.

Be sure to invest effectively, too -- such as in a low-cost, broad-market index fund. Index funds are arguably the easiest way to invest in the stock market and require very little expertise or attention. And they're effective wealth builders, too, outperforming many mutual funds that are actively managed by well-paid money managers on Wall Street.

3. Be determined -- and patient

Finally, here's the secret sauce to getting very wealthy via the stock market: determination and patience. Without determination, you might lose interest in your great plan to amass a million dollars -- especially if the stock market has a lackluster year early on. Patience goes hand in hand with determination because for best results, you need to keep at it for several decades. Revisit the table above and you'll see how the really big money appears many years after you start saving and investing.

Becoming a millionaire (if not a multimillionaire) is more possible than you might think -- as long as you work at it diligently. It's almost mathematically guaranteed.