You can start taking birth control at any time (as long as you are sure you aren't pregnant!), but the type you’re taking and at which point during your menstrual cycle you start determines when it actually becomes effective.
Combination pills, vaginal ring, and patch:
If you start taking your pills, insert your vaginal ring, or apply your patch within five days after the start of your last period, you’ll be protected from pregnancy right away. For example, if your period started on the morning of the 1st, you can start your pill any time until the morning of the 5th, and be protected against pregnancy right away. If you start taking your birth control anytime after the 5th day of your cycle, you won’t be protected against pregnancy for 7 days. During these 7 days, you should use backup contraception (like condoms) during vaginal sex, since there is still a possibility you could get pregnant.
Progestin-only pills are effective 48 hours after you begin taking them. If you have vaginal sex within 48 hours of starting a progestin-only pill, you should use a back-up contraception (like condoms) to prevent pregnancy.
Keep in mind, even after you’ve been taking your birth control long enough for it to be effective, you still have to follow the guidelines to maintain its efficacy, such as taking the pill at the same time each day and avoiding certain medications. Additionally, birth control does not protect against STIs, so be sure to use condoms or other contraceptive methods if you’re unsure of your partner’s sexual history.