<prompt> Human: Ive been trying to find an answer to this through Google, but I cant seem to word it right to find the answer I need. As I understand it, any contributions I make to a Roth IRA can be withdrawn at any time without a penalty. So say I deposit 5,000 into my IRA and buy some funds with that money. Over time, that investment grows to 10,000. I then sell that investment and have 10k in cash in the IRA. Even though you couldnt say which dollars came from my contribution and which dollars are gains from the investment, can I still withdraw 5,000 from my IRA without penalty?Now, what if it goes the other way? My 5k investment drops to 2k in value. If I sell that investment, can I still withdraw 2k without any penalties?The reason I ask is because I have some extra cash on hand that I would like to do something useful with, but I would want to be able to retrieve that money should I have an emergency that goes beyond my emergency reserve funds, or if I decide to buy a house or something like that.  <response>: Youre correct in the first case that you can take out 5k. Youre correct in the second case that you can take out the 2k.As a third scenario, if you put in 5k, it drops to 2k in value, then put in 5k more and it all grows to 10k, you can take out all 10k. As long as you dont take out more total than you put in, regardless of how the value changes over time, you dont need to worry about the penalty. 