It depends on how you "withdraw" it and "put it back".
If you take out and then return the money "normally", it is a contribution and counts against the $6k annual limit. As a second option, however, you can reverse the distribution as a rollover if you follow these two rules:
- The funds must be returned within 60 days.
- The funds must not have been used in a rollover within the past 12 months.
The administrator of your Roth IRA should have a process (usually involving a couple forms) to complete the rollover or distribution reversal. A rollover does not contribute towards the $6k limit.
What this means practically is that you get a free 60 day loan from the Roth IRA.
A third option is to ask your IRA custodian to do a "return of contributions" or "removal of excess". They may have a special form to fill out in order to do this. You choose a particular contribution that you made previously, and they return part or all of that contribution to you, plus any earnings or minus any losses. This must be done before the due date of your tax return for the year of the contribution, and the earnings, if any, will count as taxable income.
If you do this, then the original contribution no longer counts towards the $6k limit, but when you put the money back in, that will count towards the limit.