~までに
Complete something by a deadline
You'll be able to state the latest time by which an action must be completed.

蓮は五時までに宿題を終わらせます。
ren wa goji made ni shukudai o owarasemasu.
What do you think this sentence means?
Ren will finish his homework by five.
Set a deadline
~までに gives the latest time by which an action must happen or be completed. It does not mean the action continues until that time.
金曜日までに返してください。
kin'youbi made ni kaeshite kudasai.
Please return it by Friday.
Form and use ~までに
Choose a completion or occurrence such as returning, submitting, or finishing. Plain まで describes continuation up to an endpoint; adding に changes the time relationship.
金曜日までに返してください。
kin'youbi made ni kaeshite kudasai.
Please return it by Friday.
バスが来るまでに切符を買います。
basu ga kuru made ni kippu o kaimasu.
I will buy a ticket before the bus arrives.
Until versus by
The same clock time can be an endpoint of continuation or a deadline.
まで
五時まで勉強します。
goji made benkyou shimasu.
I study until five.
Studying continues up to five.
までに
五時までに勉強を終えます。
goji made ni benkyou o oemasu.
I finish studying by five.
Finishing happens no later than five.
レポートは金曜日までに出してください。
repooto wa kin'youbi made ni dashite kudasai.
Please hand in your report by Friday.
図書館の本は来週の月曜日までに返します。
toshokan no hon wa raishuu no getsuyoubi made ni kaeshimasu.
I'll return the library books by next Monday.
夜十時までに帰ってきてね。
yoru juuji made ni kaette kite ne.
Be home by ten tonight, okay?
7 more examples in the grammar path — free for a limited time.