Unplanned purchases are a part of life no matter your age. You walk into a store expecting to buy milk and come out with an $80 appliance that caught your eye. You head home from work expecting to cook dinner, then run into friends who invite you to a pricey restaurant.

Spending money on unplanned items or experiences doesn't make you flaky or financially irresponsible, provided you're saving a healthy amount off the bat. If you aren't, however, then you'll need to learn to rein in your spending before you find yourself buried in a big fat pile of debt.

But it's not just a frightening credit card balance you have to worry about when you spend money without thinking it through. Also consider that in making too many unplanned purchases, you might be thwarting other major goals, like buying a home, building emergency savings, or funding a nest egg.

Group of young adults dining out

Image source: Getty Images.

Of course, we're all guilty of making impulse buys once in a while, and again, there's nothing wrong with the occasional splurge. And at the risk of ragging too heavily on millennials, members of that age group are notorious for blowing their paychecks on needless items that offer nothing more than instant gratification (at least that's what the media tells us -- often).

Now in millennials' defense, a large number of younger folks are grappling with stingy salaries and mountains of student debt -- hardly a helpful combination. That said, millennials spend a whopping $411 a month, on average, on unplanned purchases, according to data from American Express. And unfortunately, too many last-minute concerts, clothing items, and drinks with friends can land you in a world of money-related trouble, so if you're not yet in a solid place financially, you'll need to put a stop to that pattern.

Know what you can afford to spend

It's hard to deprive yourself of life's luxuries -- after all, that's a big part of the reason why you work hard at your job. But the more you spend on unplanned items, the more you'll derail your long-term goals and increase your risk of racking up debt.

The solution? It's multipronged, but here goes. Start by taking 15% of each paycheck you receive and sending it directly into a savings or retirement account. If you don't have an emergency fund, focus first on the former. If you're good on short-term savings, go with the latter by either signing up for your employer's 401(k) or finding an IRA that lets you make automatic deposits.

Once that's done, create a budget. To do so, list your obligatory monthly expenses, compare that total to the amount you get in your paychecks after taxes and savings contributions, and figure out how much you have left over to spend. That number, however large or small it might be, is the amount you have available to spend as you please.

If it turns out you can afford to be spending $411 a month on unplanned purchases, then by all means, continue doing so (unless, of course, you're saving to buy a home or make another large purchase, in which case you'll need to prioritize). On the other hand, if, after doing all of that math, you realize you only have $200 to spend on a whim, you'll need to stick to that limit to avoid racking up debt.

Either way, be sure to pay yourself first. If you don't, there's a good chance your savings will go neglected for years on end, and that's a good way to wreck your finances irreparably and ensure that you never actually get to retire.

Remember, we're all human, which means we're likely to fall victim to temptations large and small. But if you make a point of automating your savings and sticking to a budget, you don't need to feel bad about joining your buddies for a last-minute movie or dropping $30 here and there on takeout. Life is meant to be enjoyed, and if you're able to do so while staying on track financially, you'll really get the best of both worlds.

The Motley Fool has a disclosure policy.