Can you do pregnancy test 4 to 5 days before your periods?

Yes you can, though the accuracy is decreased that early. But you still can.