The more frequently you trade, the more you'll pay your broker in commission fees. But many people may not know that factoring in the cost of those commissions can reduce your capital gains -- and cut the taxes you owe.

Imagine that you buy 100 shares of Alaska-centric delivery company Iditarod Express (Ticker: MUSHH) at $25 apiece. You pay your brokerage an extra $25 for that $2,500 purchase. Two years later, you sell the shares for $35 each, forking over another $25 while collecting $3,500. You might assume that the taxable capital gain here is $1,000, the difference between the cost and the sale proceeds. You'd be wrong.

Recapture your capital gains
When preparing your taxes, your purchase cost and your sale price should both include the cost of the commission. In the example above, that means you bought the shares for a total of $2,525, not $2,500, and received a total of $3,475 when you sold them. Thus, your gain is $950, not $1,000. At a 15% tax rate, that'll save you $7.50 in taxes.

That might not seem like much … until it starts adding up. If you buy and sell stocks 30 times in a year, you might save $225. While many online brokers now charge far less than $25 per trade -- consult our Broker Center for a comparison list -- some people still pay "full-service" brokerages $300 or more per trade! At that rate, you can't afford to ignore commission costs on your taxes.

The right way to buy and sell shares
To maximize your savings, avoid paying such hefty fees in the first place by employing smarter trading strategies. You may be able to qualify for cheaper or free trading, depending on your broker, your account amounts, or your trading volume. You should also avoid broker-assisted trades in favor of online trades whenever possible; according to Smart Money magazine's annual brokerage survey, the former could cost you far more than the latter.

Even without these discounts, you can still expect discount brokers like Charles Schwab (NASDAQ:SCHW) and TD AMERITRADE (NASDAQ:AMTD) to charge just a fraction of what you might pay at full-service brokerages such as Morgan Stanley (NYSE:MS) and Goldman Sachs (NYSE:GS). Whether or not you take full tax advantage of commission fees, it's worth the effort to find the best broker for you.

Learn more about investing and taxes in our Tax Center.

Longtime Fool contributor Selena Maranjian does not own shares of any companies mentioned in this article. Charles Schwab is a Motley Fool Stock Advisor pick. Try our investing newsletters free for 30 days. The Motley Fool is Fools writing for Fools.