Retained earnings are calculated using the following formula:
Retained Earnings = Beginning Retained Earnings + Net Income - Dividends Paid
For example, if a company starts with $1 million in retained earnings, earns $200,000 in net income, and pays $50,000 in dividends, its retained earnings at the end of the period would be $1,150,000.