For traditional IRA and Roth IRA, can capital loss be used to offset taxable income for tax purpose?
If not, when withdrawing from traditional IRA and Roth IRA, can the capital loss now be used to offset taxable income?
Edited in response to JoeTaxpayer's comment and OP Tim's additional question.
To add to and clarify a little what littleadv has said, and to answer OP Tim's next question:
As far as the IRS is concerned, you have at most one Individual Retirement Account of each type (Traditional, Roth) though the money in each IRA can be invested with as many different custodians (brokerages, banks, etc.) and different investments as you like. Thus, the maximum $5000 ($6000 for older folks) that you can contribute each year can be split up and invested any which way you like, and when in later years you take a Required Minimum Distribution (RMD) from a Traditional IRA, you can get the money by selling just one of the investments, or from several investments; all that the IRS cares is that the total amount that is distributed to you is at least as large as the RMD. An important corollary is that
the balance in your IRA is the sum total of the value of all the investments that various custodians are holding for you in IRA accounts.
There is no loss in an IRA until every penny has been withdrawn from every investment in your IRA and distributed to you, thus making your IRA balance zero. As long as you have a positive balance, there is no loss: everything has to come out.
After the last distribution from your Roth IRA (the one that empties your entire Roth IRA, no matter where it is invested and reduces your Roth IRA balance (see definition above) to zero), total up all the amounts that you have received as distributions from your Roth IRA. If this is less than the total amount of money you contributed to your Roth IRA (this includes rollovers from a Traditional IRA or Roth 401k etc., but not the earnings within the Roth IRA that you re-invested inside the Roth IRA), you have a loss that can be deducted on Schedule A as a Miscellaneous Deduction subject to the 2% AGI limit. This 2% is not a cap (in the sense that no more than 2% of your AGI can be deducted in this category) but rather a threshold: you can only deduct whatever part of your total Miscellaneous Deductions exceeds 2% of your AGI. Not many people have Miscellaneous Deductions whose total exceeds 2% of their AGI, and so they end up not being able to deduct anything in this category.
If you ever made nondeductible contributions to your Traditional IRA because you were ineligible to make a deductible contribution (income too high, pension plan coverage at work etc), then the sum of all these contributions is your basis in your Traditional IRA. Note that your deductible contributions, if any, are not part of the basis. The above rules apply to your basis in your Traditional IRA as well. After the last distribution from your Traditional IRA (the one that empties all your Traditional IRA accounts and reduces your Traditional IRA balance to zero), total up all the distributions that you received (don't forget to include the nontaxable part of each distribution that represents a return of the basis). If the sum total is less than your basis, you have a loss that can be deducted on Schedule A as a Miscellaneous Deduction subject to the 2% AGI threshold.
You can only deposit cash into an IRA and take a distribution in cash from an IRA. Now, as JoeTaxpayer points out, if your IRA owns stock, you can take a distribution by having the shares transferred from your IRA account in your brokerage to your personal account in the brokerage. However, the amount of the distribution, as reported by the brokerage to the IRS, is the value of the shares transferred as of the time of the transfer, (more generally the fair market value of the property that is transferred out of the IRA) and this is the amount you report on your income tax return. Any capital gain or loss on those shares remains inside the IRA because your basis (in your personal account) in the shares that came out of the IRA is the amount of the distribution. If you sell these shares at a later date, you will have a (taxable) gain or loss depending on whether you sold the shares for more or less than your basis. In effect, the share transfer transaction is as if you sold the shares in the IRA, took the proceeds as a cash distribution and immediately bought the same shares in your personal account, but you saved the transaction fees for the sale and the purchase and avoided paying the difference between the buying and selling price of the shares as well as any changes in these in the microseconds that would have elapsed between the execution of the sell-shares-in-Tim's-IRA-account, distribute-cash-to-Tim, and buy-shares-in-Tim's-personal account transactions. Of course, your broker will likely charge a fee for transferring ownership of the shares from your IRA to you. But the important point is that any capital gain or loss within the IRA cannot be used to offset a gain or loss in your taxable accounts. What happens inside the IRA stays inside the IRA.
No, you cannot.
If you withdraw everything from all your Roth IRA's and end up with less than the total basis - you can deduct the difference on your schedule A (at the time of the last withdrawal) as an itemized deduction (as misc. deductions with 2% AGI cap).
Regular IRA's are pre-tax, you cannot deduct anything from them.