The Shulchan Aruch · Orach Chayim
אורח חיים ל״זOrach Chayim 37
Siman 37 of 697 in Orach Chayim — 3 se'ifim
הלכות תפיליןLaws of Tefillin· siman 37
Se’if 1א׳
גָּדוֹל שְׂכַר מִצְוַת תְּפִלִּין, וְכָל מִי שֶׁאֵינוֹ מְנִיחָם הוּא בִּכְלַל פּוֹשְׁעֵי יִשְׂרָאֵל בְּגוּפָן.
Great is the reward for the mitzvah of tefillin, and anyone who does not wear them is included in the group of "sinners of Israel" [sinning in their] bodies.
Se’if 2ב׳
מִצְוָתָן לִהְיוֹתָם עָלָיו כָּל הַיּוֹם אֲבָל מִפְּנֵי שֶׁצְּרִיכִים גּוּף נָקִי שֶׁלֹּא יָפִיחַ בָּהֶם, וְשֶׁלֹּא יַסִיחַ דַּעְתּוֹ מֵהֶם, וְאֵין כָּל אָדָם יָכוֹל לִזָּהֵר בָּהֶם, נָהֲגוּ שֶׁלֹּא לַהֲנִיחָם כָּל הַיּוֹם. וּמִכָּל מָקוֹם צָרִיךְ כָּל אָדָם לִזָּהֵר בָּהֶם לִהְיוֹתָם עָלָיו בִּשְׁעַת קְרִיאַת שְׁמַע וּתְפִלָּה.
It is a Mitzvah to have them [tefillin] on all day, but because they [tefillin] need a clean body [meaning that] he does not pass gas, and [further require] that one not distract his mind from them, and not every person is able to be careful with them, the practice is not to wear them all day. Nevertheless every man needs to be careful with them that they should be on him during the reciting of Shema and Tefilah [aka Shemoneh Esreh].
Se’if 3ג׳
קָטָן הַיּוֹדֵעַ לִשְׁמֹר תְּפִלִּין בְּטָהֳרָה שֶׁלֹּא יִישַׁן בָּהֶם וְלֹא יָפִיחַ בָּהֶם, הַגָּה: וְשֶׁלֹּא לִכָּנֵס בָּהֶן לְבֵית הַכִּסֵּא (רַשִׁ"י פ' לוּלָב הַגָּזוּל) חַיָּב אָבִיו לִקְנוֹת לוֹ תְּפִלִּין לְחַנְּכוֹ: הַגָּה: וְיֵשׁ אוֹמְרִים דְּהַאי קָטָן דַּוְקָא שֶׁהוּא בֶּן י"ג שָׁנִים וְיוֹם אֶחָד (בַּעַל הָעִטּוּר) וְכֵן נָהֲגוּ וְאֵין לְשַׁנּוֹת (דִּבְרֵי עַצְמוֹ):
A minor who knows to guard tefillin in purity, such that he will not sleep or flatulate while wearing them Rema: and not to enter the bathroom with them [based on Rashi in the chapter of "The Stolen Lulav"] his father is obligated to acquire tefillin for him in order to train him [in the commandment]. Rema: "And some say that this 'minor' is only if he is 13 years and one day (Ba’al HaIitur). And so is the custom and one should not change from it.
Shulchan Aruch, Orach Chayim — Torat Emet 363 edition, via Sefaria — public domain
English: Sefaria Community Translation — CC0