Retained earnings are the profits that a company has left over after paying out any costs and distributing any dividends to shareholders. These profits are typically used to reinvest back into the company to help it grow. While the more retained earnings a company has, the healthier it appears to be financially, this also depends on the maturity of the company.
Growing companies sometimes forgo paying dividends so that they have more retained earnings to use for reinvestment. This could be to fund more R&D, marketing, hiring, or paying for new equipment. Some companies may keep their retained earnings as a safeguard against potential future losses. But as a company grows, it has less use for retained earnings in reinvestment and so typically begins to pay out dividends. This would leave it with less retained earnings, but not necessarily financially unhealthy.
This is how retained earnings are calculated:
Beginning retained earnings + net profit/loss - dividends = end retained earnings
Beginning retained earnings, also known as current retained earnings, refers to the amount of retained earnings you had last time it was calculated.
For example, if you calculate this monthly, let's say in January, you made $5,000 profit but you paid no dividends. Then your retained earnings as of February 1st would be $5,000. Let's imagine you made $6,000 profit in February, and you want to pay out $1,000 in dividends to your investors as a thank you. Then your retained earnings as of March 1st would be:
$5,000 + $6,000 - $1,000 = $10,000
Remember your beginning retained earnings from January were $5,000. Retained earnings are calculated at the end of each accounting period, whether that's monthly, quarterly, or annually. And so your beginning retained earnings are taken from the previous accounting period.