"Within" and "in" when referring to time

Within is regarded as specifying an upper limit: within two days means maybe today, maybe tomorrow, but no later than two days from now. In is sometimes regarded as more precise: in two days could mean two days from now – particularly with a scheduled event, such as a party.

That said, there are exceptions where the word in can be more ambiguous. If I tell my supervisor on a Monday:

Boss, I'll have that report ready in two days.

that could mean it'll be on his desk on Wednesday, or it could mean it'll be on his desk before Wednesday.

That being the case, it might be preferable to use on or before when you want to reduce the risk of ambiguity.