Image source: Getty Images The idea of becoming a millionaire by investing in the stock market crosses many people’s minds at some stage. But in reality few of them will achieve that goal. There are different reasons for that. But I think a common one is simply that not many people come up with a serious plan to try and become a millionaire through owning shares, then put their money into making it happen. I think doing it may be hard, but is nonetheless possible. Here is an example, based on buying UK income stocks. Putting money to work The core of my approach would be to set aside some money regularly to invest in shares. As well as using that cash to buy shares I would reinvest all of the dividends I earn into buying more shares. That is known as compounding. If I put aside £3,000 each month and compound it, aiming for a compounded annual growth rate of 10%, I would have a share portfolio worth over half a million pounds in less than a decade. By 2032, I should be sitting on shares worth around £511,000. Compounding works like a snowball that can keep growing in size, as dividends themselves effectively start to earn dividends. So as time went by, my progress ought to get faster. I should be a millionaire within 14 years. Starting this January, that could mean that I would have a seven-figure share portfolio by 2037! Understanding the maths That approach includes some significant presumptions, however. First, I used the sum of £3,000 per month. That is a substantial amount of money to invest, although as becoming a millionaire is an ambitious goal, that should come as little surprise. I could use the same plan with a smaller monthly contribution. However, my progress would be slower. The compound annual growth rate of 10% is also ambitious, although it strikes me as potentially achievable. It will be critical that I choose the right shares. I would focus on investing in high-quality companies I felt could sustain their dividends rather than chasing yield and ending up buying value traps. The example above is also based on constant dividends and share prices. In reality that may not happen and I could even lose money. But the example illustrates the power of compounding dividends in helping me reach my target. Focus on income stocks As my plan calls for a 10% compound annual growth rate, why would my focus be on income shares? After all, if I chose the right growth shares I could hopefully achieve that result too. I would focus on income shares if putting this plan into action because I feel that right now there are some high-quality income stocks selling at attractive prices and with high yields to boot. For example, insurer Direct Line yields 9.7%. If I bought the shares and the company kept paying its current dividend (which is never guaranteed), just a small amount of capital growth could help me hit my 10% annual return target. By choosing shares carefully and selectively, diversifying my portfolio and sticking to my plan, I think I could be halfway towards being a stock market millionaire in under a decade.