When can i take a pregnancy test

Ive been looking online but I cant find any definite answers on this. So I had unprotected sex 9 days ago and am due to get my period today. Is it too early to take a test? When would be the earliest I can take it?