How many days after sex should I take a pregnancy test

I had unprotected sex on the 21st. I want to make sure I am or I'm not pregnant. When should I take a test? How many days after?