Can I use losses from sale of stock to offset capital gains from sale of property
Capital losses from the sale of stocks can be used to offset capital gains from the sale of a house, assuming that house was a rental property the whole time.  If it was your principal residence, the capital gains are not taxed.  If you used it as both a rental and a principal residence, then it gets more complicated: http://www.cra-arc.gc.ca/tx/ndvdls/tpcs/ncm-tx/rtrn/cmpltng/rprtng-ncm/lns101-170/127/rsdnc/menu-eng.html
"The wash sale rule only applies when the sale in question is at a loss.  So the rule does not apply at all to your cases 3, 4, 7, 8, 11, 12, 15, and 16, which all start with a gain.  You get a capital gain at the first sale and then a separately computed gain / loss at the second sale, depending on the case, BUT any gain or loss in the IRA is not a taxable event due to the usual tax-advantaged rules for the IRA. The wash sale does not apply to ""first"" sales in your IRA because there is no taxable gain or loss in that case.  That means that you wouldn't be seeking a deduction anyway, and there is nothing to get rolled into the repurchase. This means that the rule does not apply to 1-8.  For 5-8, where the second sale is in your brokerage account, you have a ""usual"" capital gain / loss as if the sale in the IRA didn't happen. (For 1-4, again, the second sale is in the IRA, so that sale is not taxable.) What's left are 9-10 (Brokerage -> IRA) and 13-14 (Brokerage -> Brokerage).   The easier two are 13-14.  In this case, you cannot take a capital loss deduction for the first sale at a loss.  The loss gets added to the basis of the repurchase instead.  When you ultimately close the position with the second sale, then you compute your gain or loss based on the modified basis.  Note that this means you need to be careful about what you mean by ""gain"" or ""loss"" at the second sale, because you need to be careful about when you account for the basis adjustment due to the wash sale. Example 1: All buys and sells are in your brokerage account.  You buy initially at $10 and sell at $8, creating a $2 loss.  But you buy again within the wash sale window at $9 and sell that at $12.  You get no deduction after the first sale because it's wash.  You have a $1 capital gain at the second sale because your basis is $11 = $9 + $2 due to the $2 basis adjustment from wash sale. Example 2: Same as Example 1, except that final sale is at $8 instead of at $12.  In this case you appear to have taken a $2 loss on the first buy-sell and another $1 loss on the second buy-sell.  For taxes however, you cannot claim the loss at the first sale due to the wash.  At the second sale, your basis is still $11 (as in Example 1), so your overall capital loss is the $3 dollars that you might expect, computed as the $8 final sale price minus the $11 (wash-adjusted) basis. Now for 9-10 (Brokerage->IRA), things are a little more complicated.  In the IRA, you don't worry about the basis of individual stocks that you hold because of the way that tax advantages of those accounts work.  You do need to worry about the basis of the IRA account as a whole, however, in some cases.  The most common case would be if you have non-deductable contributions to your traditional IRA.  When you eventually withdraw, you don't pay tax on any distributions that are attributable to those nondeductible contributions (because you already paid tax on that part).  There are other cases where basis of your account matters, but that's a whole question in itself - It's enough for now to understand 1. Basis in your IRA as a whole is a well-defined concept with tax implications, and 2. Basis in individual holdings within your account don't matter. So with the brokerage-IRA wash sale, there are two questions:  1. Can you take the capital loss on the brokerage side?  2. If no because of the wash sale, does this increase the basis of your IRA account (as a whole)?  The answer to both is ""no,"" although the reason is not obvious. The IRS actually put out a Special Bulletin to answer the question specifically because it was unclear in the law. Bottom line for 9-10 is that you apparently are losing your tax deduction completely in that case. In addition, if you were counting on an increase in the basis of your IRA to avoid early distribution penalties, you don't get that either, which will result in yet more tax if you actually take the early distribution. In addition to the Special Bulletin noted above, Publication 550, which talks about wash sale rules for individuals, may also help some." No one can advise you on whether to hold this stock or sell it. Your carried losses can offset short or long term gains, but the long term losses have to be applied to offset long term gains before any remaining losses can offset short term gains. Your question doesn't indicate how long you have to hold before the short term gains become long term gains. Obviously the longer the holding period, the greater the risk. You also must avoid a wash sale (selling to lock in the gains/reset your basis then repurchasing within a month). All of those decisions hold risks that you have to weigh. If you see further upside in holding it longer, keep the investment. Don't sell just to try to maximize tax benefits. Brokerage->Brokerage 13-16 The loss from the previous purchase will be added to the cost basis of the security for the second purchase. Since you sold it at a loss again it would increase your losses. Your loss from the first sale will be disallowed. Your loss will be added to the cost basis of the next purchase. Your gains will be taxed on the total of the cost basis which will reduce your gains. Which you will taxed 'less'. Your gains will be taxed. Your loss is allowed. You will be taxed on both.  Wash Sales really only applies to losses. If you sell for gain, the tax man will be happy to take his share. From my understanding, it does not matter if it is IRA or Brokerage, the wash sale rule affects them all. Check this link: http://www.marketwatch.com/story/understanding-the-wash-sale-rules-2015-03-02 The harvested losses are capital losses.  See this IRS page: Generally, realized capital losses are first offset against realized capital gains.  Any excess losses can be deducted against ordinary income up to $3,000 ($1,500 if married filing separately) on line 13 of Form 1040.  Losses in excess of this limit can be carried forward to later years to reduce capital gains or ordinary income until the balance of these losses is used up. This means that your harvested losses can be used to offset ordinary income --- up to $3000 in a single year, and with extra losses carried forward to future years.  It is pretty close to a free lunch, provided that you have some losses somewhere in your portfolio. This free lunch is available to anyone, but for a human, it can be quite a chore to decide when to sell what, keep track of the losses, and avoid the wash sale rules.  The advantage of robo-advisors is that they eat that kind of bookkeeping for breakfast, so they can take advantage of tax loss harvesting opportunities that would be too cumbersome for a human to bother with. Don't let tax considerations be the main driver. That's generally a bad idea. You should keep tax in mind when making the decision, but don't let it be the main reason for an action. selling the higher priced shares (possibly at a loss even) - I think   it's ok to do that, and it doesn't necessarily have to be FIFO? It is OK to do that, but consider also the term. Long term gain has much lower taxes than short term gain, and short term loss will be offsetting long term gain - means you can lose some of the potential tax benefit. any potential writeoffs related to buying a home that can offset capital gains? No, and anyway if you're buying a personal residence (a home for yourself) - there's nothing to write off (except for the mortgage interest and property taxes of course). selling other investments for a capital loss to offset this sale? Again - why sell at a loss? anything related to retirement accounts? e.g. I think I recall being able to take a loan from your retirement account in order to buy a home You can take a loan, and you can also withdraw up to 10K without a penalty (if conditions are met). Bottom line - be prepared to pay the tax on the gains, and check how much it is going to be roughly. You can apply previous year refund to the next year to mitigate the shock, you can put some money aside, and you can raise your salary withholding to make sure you're not hit with a high bill and penalties next April after you do that. As long as you keep in mind the tax bill and put aside an amount to pay it - you'll be fine. I see no reason to sell at loss or pay extra interest to someone just to reduce the nominal amount of the tax. If you're selling at loss - you're losing money. If you're selling at gain and paying tax - you're earning money, even if the earnings are reduced by the tax. Unless your investments are held within a special tax-free account, then every sale transaction is a taxable event, meaning a gain or loss (capital gain/loss or income gain/loss, depending on various circumstances) is calculated at that moment in time. Gains may also accrue on unrealized amounts at year-end, for specific items [in general in the US, gains do not accrue at year-end for most things]. Moving cash that you have received from selling investments, from your brokerage account to your checking account, has no impact from a tax perspective. Yes. As long as the stock is in a taxable account (i.e. not a tax deferred retirement account) you'll pay gain on the profit regardless of subsequent purchases.  If the sale is a loss, however, you'll risk delaying the claim for the loss if you repurchase identical shares within 30 days of that sale. This is called a wash sale. "Generally if you are using FIFO (first in, first out) accounting, you will need to match the transactions based on the number of shares. In your example, at the beginning of day 6, you had two lots of shares, 100 @ 50 and 10 @ 52.  On that day you sold 50 shares, and using FIFO, you sold 50 shares of the first lot.  This leaves you with 50 @ 50 and 10 @ 52, and a taxable capital gain on the 50 shares you sold. Note that commissions incurred buying the shares increase your basis, and commissions incurred selling the shares decrease your proceeds.  So if you spent $10 per trade, your basis on the 100 @ 50 lot was $5010, and the proceeds on your 50 @ 60 sale were $2990.  In this example you sold half of the lot, so your basis for the sale was half of $5010 or $2505, so your capital gain is $2990 - 2505 = $485. The sales you describe are also ""wash sales"", in that you sold stock and bought back an equivalent stock within 30 days.  Generally this is only relevant if one of the sales was at a loss but you will need to account for this in your code.  You can look up the definition of wash sale, it starts to get complex. If you are writing code to handle this in any generic situation you will also have to handle stock splits, spin-offs, mergers, etc. which change the number of shares you own and their cost basis.  I have implemented this myself and I have written about 25-30 custom routines, one for each kind of transaction that I've encountered.  The structure of these deals is limited only by the imagination of investment bankers so I think it is impossible to write a single generic algorithm that handles them all, instead I have a framework that I update each quarter as new transactions occur." (I'm assuming the tag of United-states is accurate) Yes, the remaining amount is tax free -- at the current price.  If you sell at exactly the original price, there is no capital gain, no capital loss.  So you've already payed the taxes. If you sell and there is a capital gain of $3000, then you will pay taxes on the $3000.  If 33% is your marginal tax rate, and if you held the stock for less than a year, then you will keep $7000 and pay taxes of $1000.  Somehow, I doubt your marginal tax rate is 33%. If you hold the stock for a year after eTrade sold some for you to pay taxes, then you will pay 15% on the gain -- or $450. eTrade sold the shares to pay the taxes generated by the income.  Yes, those shares were considered income.  If you sell and have a loss, well, life sucks.  However, if you sell something else, you can use the loss to offset the other gain.  So if you sell stock A for a loss of $3000, and sell stock B at a gain of $4000, then you pay taxes on the net of $1000. "For example, if I have an income of $100,000 from my job and I also   realize a $350,000 in long-term capital gains from a stock sale, will   I pay 20% on the $350K or 15%? You'll pay 20% assuming filing single and no major offsets to taxable income. Capital gains count towards your income for determining tax bracket. They're on line 13 of the 1040 which is in the ""income"" section and aren't adjusted out/excluded from your taxable income, but since they are taxed at a different rate make sure to follow the instructions for line 44 when calculating your tax due." If you make money in currency speculation (as in your example), that is a capital gain. A more complicated example is if you were to buy and then sell stocks on the mexican stock exchange.  Your capital gain (or loss) would be the difference in value in US dollars of your stocks accounting for varying exchange rates.  It's possible for the stocks to go down and for you to still have a capital gain, and vice versa. Yes you can.  This is known as a short selling against the box.  In the old days, this was used to delay a taxable event.  You could lock in a gain without triggering a taxable event.  Any loss on one side of the box would be offset by a loss on the other side, and vice versa.  However, the IRS clamped down on this, and you will realize the gain on your long position as soon as you go short on the other side.  See http://www.investopedia.com/terms/s/sellagainstthebox.asp. As to how to initiate the short cover, just transfer the long position to the same account as your short position and make sure your broker covers the short.  Should be relatively easy. If the income is more than the value on the 1099-MISC - then yes. Depending on how long you've held the car, the difference would be short term/long term capital gain. You cannot deduct loss, though, since it is a personal property and not investment. "You uncle is liable to pay ""Capital-Gains"" tax. Essentially the sale price less of cost would be treated as gains. The gains are taxed at 10% without indexation and 20% with Indexation.  The capital gains tax can be avoided if your uncle invests the gains into specified ""Infrastructure bonds"" or buys another property within a period of 3 years. The funds need to be kept in a separate ""Capital Gains"" account and not a regular savings account till you buy another property within 3 years." "Yes- you do not realize gains or losses until you actually sell the stock.  After you sell the initial stocks/bonds you have realized the gain.  When you buy the new, different stocks you haven't realized anything until you then sell those. There is one exception to this, called the ""Wash-Sale Rule"".  From Investopedia.com: With the wash-sale rule, the IRS disallows a loss deduction from the   sale of a security if a ‘substantially identical security' was purchased within 30 days before or after the sale.  The   wash-sale period is actually 61 days, consisting of the 30 days before   and the 30 days after the date of the sale. For example, if you bought   100 shares of IBM on December 1 and then sold 100 shares of IBM on   December 15 at a loss, the loss deduction would not be allowed.   Similarly, selling IBM on December 15 and then buying it back on   January 10 of the following year does not permit a deduction. The   wash-sale rule is designed to prevent investors from making trades for   the sole purpose of avoiding taxes."