Halacha

הלכה א
הַיּוֹצֵא חוּץ לִתְחוּם הַמְּדִינָה בְּשַׁבָּת לוֹקֶה שֶׁנֶּאֱמַר (שמות טז כט) "אַל יֵצֵא אִישׁ מִמְּקֹמוֹ בַּיּוֹם הַשְּׁבִיעִי". מָקוֹם זֶה הוּא תְּחוּם הָעִיר. וְלֹא נָתְנָה תּוֹרָה שִׁעוּר לִתְחוּם זֶה אֲבָל חֲכָמִים הֶעְתִּיקוּ שֶׁתְּחוּם זֶה הוּא חוּץ לִשְׁנֵים עָשָׂר מִיל כְּנֶגֶד מַחֲנֵה יִשְׂרָאֵל. וְכָךְ אָמַר לָהֶם משֶׁה רַבֵּנוּ לֹא תֵּצְאוּ חוּץ לַמַּחֲנֶה. וּמִדִּבְרֵי סוֹפְרִים שֶׁלֹּא יֵצֵא אָדָם חוּץ לָעִיר אֶלָּא עַד אַלְפַּיִם אַמָּה אֲבָל חוּץ לְאַלְפַּיִם אַמָּה אָסוּר. שֶׁאַלְפַּיִם אַמָּה הוּא מִגְרַשׁ הָעִיר:
כסף משנה
1.
A person who goes beyond [his] city's Sabbath limit should be punished by lashes, as [Exodus 16:29] states: "No man should leave his place on the seventh day."1Sefer HaMitzvot (Negative Commandment 321) and Sefer HaChinuch (Mitzvah 24) include this prohibition as one of the 613 mitzvot of the Torah.
Having covered all the prohibitions associated with the performance of labor on the Sabbath, in this and the next chapter the Rambam focuses on another Biblical prohibition associated with the Sabbath - the prohibition against departing from one's location. With regard to this prohibition, it is also significant to consult Hilchot Eruvin, Chapters 6-8, which mention extending the Sabbath limits mentioned here through a convention of Rabbinic origin known as eruv t'chumim.
[The term] "place" refers to the city's Sabbath limits.
The Torah did not [explicitly] state the measure of this limit. The Sages, however, transmitted the tradition that this measure was twelve mil,2A mil is approximately one kilometer.
There are those who interpret the Rambam's ruling here as a change in his position from Sefer HaMitzvot, which can be interpreted as stating that the limit of two thousand cubits has its source in the Torah itself. In a responsa, however, the Rambam explicitly states that his statements in Sefer HaMitzvot were intended to be general in nature, to be clarified in the Mishneh Torah.
It must also be noted that there are many authorities (among them the Ramban and the Rashba) who maintain that the Sabbath limits are a Rabbinic prohibition. (According to this view, the allusion to Exodus 16:29 is merely an asmachta.) Significantly, there is an early reference in the Rambam's works (Commentary to the Mishneh, Sotah 5:3) which supports this view.
The fundamental basis for these positions can be explained as follows: The measure of twelve mil is mentioned in the Jerusalem Talmud (Eruvin 1:10), but not in the Babylonian Talmud. The Babylonian Talmud (Eruvin 17a) cites a dispute between Rabbi Akiva and other Sages. Rabbi Akiva maintains that the Torah established a Sabbath limit of two thousand cubits, but the other Sages differ. According to the Rambam, the ruling of the Jerusalem Talmud is accepted. According to the other view, this represents a difference of opinion between the majority opinion in the Babylonian Talmud (which appears to state that the Torah did not establish Sabbath limits) and the Jerusalem Talmud. Generally, when there is a difference between the majority opinion in the Babylonian Talmud, and the Jerusalem Talmud, the majority opinion of the Babylonian Talmud is accepted.
The Rabbinic origin of the prohibition of two thousand cubits is universally accepted. It would appear that the Shulchan Aruch (Orach Chayim 404:1) accepts the position that the entire concept of Sabbath limits is a Rabbinic institution. The Ramah, however, requires that consideration be taken of the Rambam's view.
Note also the Tzafenat Paneach, which emphasizes that all authorities agree that the observance of limits on travel on the holidays is Rabbinic in origin.
the length of the Jews' encampment [in the desert]. Thus, Moses our teacher was instructing them, "Do not go out beyond the camp."
Our Sages ruled3According to the Rambam, as a safeguard to the prohibition of the Torah. According to the other view, as an independent prohibition. that a person should go only two thousand cubits beyond the city. [Going] beyond two thousand cubits is forbidden. [The rationale for the choice of this figure is that] two thousand cubits represents the pasture land [given to] a city.4See Numbers 35:5.

הלכה ב
נִמְצֵאתָ לָמֵד שֶׁמֻּתָּר לְאָדָם בְּשַׁבָּת לְהַלֵּךְ אֶת כָּל הָעִיר כֻּלָּהּ אֲפִלּוּ הָיְתָה כְּנִינְוֵה. בֵּין שֶׁהָיְתָה מֻקֶּפֶת חוֹמָה בֵּין שֶׁלֹּא הָיְתָה מֻקֶּפֶת חוֹמָה. וְכֵן מֻתָּר לוֹ לְהַלֵּךְ חוּץ לָעִיר אַלְפַּיִם אַמָּה לְכָל רוּחַ מְרֻבָּעוֹת כְּטַבְלָה מְרֻבַּעַת כְּדֵי שֶׁיִּהְיֶה נִשְׂכָּר אֶת הַזָּוִיּוֹת. וְאִם יָצָא חוּץ לְאַלְפַּיִם אַמָּה מַכִּין אוֹתוֹ מַכַּת מַרְדּוּת עַד שְׁנֵים עָשָׂר מִיל. אֲבָל אִם יָצָא וְהִרְחִיק מִן הָעִיר יֶתֶר עַל שְׁנֵים עָשָׂר מִיל אֲפִלּוּ אַמָּה אַחַת לוֹקֶה מִן הַתּוֹרָה:
כסף משנה
2.
[From the above,] it follows that a person may walk throughout the expanse of [any] city, even if it is as large as Nineveh, whether or not it is surrounded by a wall.5Nineveh is used as a classic example of a metropolis because of the description of the city's size in the Book of Jonah 3:3, 4:11). Significantly, the Talmud (Eruvin 61b) gives Antioch as the example, and not Nineveh.
The entire city is considered to be the person's "place," in the wording used in Exodus (loc. cit.). Hence, as long as he stays within the city's confines, or goes less than two thousand cubits beyond them, he is not considered to have "left his place."
With the expression, "whether or not, it is surrounded by a wall," the Rambam touches on a Halachic point of particular relevance in the diaspora where it is not common for a city to have an eruv. There is a question if the term "city" used throughout this chapter refers to all cities, or only to those surrounded by a wall.
The rationale behind the latter thesis is that only when a city is surrounded by a wall is it a private domain, and fit to be described as a person's "place." When the city lacks a wall, the person's place is his individual domain. See Rashi, Eruvin 61b, Shulchan Aruch HaRav 396:1.
The Maggid Mishneh (in his gloss to these halachot, and more specifically, in his gloss to Hilchot Eruvin 7:4), explains that the Rambam does not subscribe to this restriction, and considers even a city without a wall as "one's place" even if it is forbidden to carry within it.

Similarly, it is permitted for a person to walk two thousand cubits in all directions outside the city. [When calculating these two thousand cubits, the entire area] is considered to be square, like a tablet,6There is a difference of opinion among the Sages of the Mishnah (Eruvin 4:8) whether the city is considered to be the center of a circle with a radius of two thousand cubits, or the center of a square whose sides are twice that length. The Rambam follows the latter opinion, thus expanding the permitted area to include the corners of the square.
The determination of the limits of the city's boundaries from which these two thousand cubits are measured is discussed at the beginning of the following chapter.
so that [the area in between] its furthest corners will also be included.7The Maggid Mishneh states that although the corners of the square are included, one is allowed to walk 2800 cubits (the approximate distance to the corner of the square) only when one is, in fact, pointed in the direction of that diagonal. One may not arbitrarily rotate the area encompassed by the square so that one will always be walking along its diagonal.
If a person goes beyond two thousand cubits up to a distance of twelve mil, he should be given "stripes for rebelliousness"8This is the punishment given for the violation of a Rabbinic prohibition.. If he goes even one cubit beyond twelve mil, he should be punished by lashing [as prescribed] by the Torah.

הלכה ג
הַמְהַלֵּךְ חוּץ לַתְּחוּם לְמַעְלָה מֵעֲשָׂרָה טְפָחִים כְּגוֹן שֶׁקָּפַץ עַל גַּבֵּי עַמּוּדִים שֶׁגְּבוֹהִין עֲשָׂרָה וְאֵין בְּכָל אֶחָד מֵהֶן אַרְבָּעָה עַל אַרְבָּעָה טְפָחִים הֲרֵי זֶה סָפֵק אִם יֵשׁ תְּחוּמִין לְמַעְלָה מֵעֲשָׂרָה אוֹ אֵין תְּחוּמִין לְמַעְלָה מֵעֲשָׂרָה. אֲבָל אִם הָלַךְ עַל מָקוֹם שֶׁיֵּשׁ בּוֹ אַרְבָּעָה עַל אַרְבָּעָה הֲרֵי זֶה כִּמְהַלֵּךְ עַל הָאָרֶץ וְיֵשׁ אִסּוּר תְּחוּמִין שָׁם:
כסף משנה
3.
[There is a question whether] a person [is liable] if he goes beyond the Sabbath limit, [travelling] at a height of more than ten handbreadths above the ground9Since a public domain and a carmelit extend only to a height of ten handbreadths, the Sages questioned whether or not this same concept applied with regard to the Sabbath limits. - e.g., he jumps from one pillar to another - when none of the pillars has a surface area of four handbreadths by four handbreadths.10A surface less than four handbreadths by four handbreadths is not comfortable to use. Therefore, it is a matter of question (Rashi, Eruvin 43a). For there remains an unresolved question [among the Sages] whether or not the Sabbath limits apply ten handbreadths above the ground.11The Maggid Mishneh and the Kessef Mishneh cite one of the Rambam's responsa, which states that this entire question applies on dry land only. On the sea or on a river, all authorities agree that if the sea or river is more than ten handbreadths deep, the Sabbath limits do not apply.
The rationale for this leniency is that the laws concerning the Sabbath limits are also derived from the encampment of the Jews in the desert, and there the Sabbath limits were measured only on the land, and more particularly, in a public domain. When a domain is classified within the category of carmelit, e.g., seas and rivers, the establishment of the Sabbath limits is merely Rabbinic in origin. Therefore, since the case at hand - whether the Sabbath limits apply above ten handbreadths - is a point in question, we follow the principle: When in doubt regarding a point of Rabbinic law, the more lenient view should be followed. (See Chapter 30, Halachah 13 and notes, for a further discussion of this issue.)
.
[The matter is one of question only in an instance similar to the example given.] If, by contrast, a person walks on a surface that is four [handbreadths] by four [handbreadths], it is as if he is walking on the ground [even though the surface is ten handbreadths above the ground].12Eruvin 43a uses the expression, "It is like thick ground." The Sabbath limits apply in such an instance.

הלכה ד
מִי שֶׁשָּׁבַת בְּדִיר שֶׁבַּמִּדְבָּר אוֹ בְּסַהַר אוֹ בִּמְעָרָה וְכַיּוֹצֵא בָּהֶן מֵרְשׁוּת הַיָּחִיד מְהַלֵּךְ אֶת כֻּלָּהּ וְחוּצָה לָהּ אַלְפַּיִם אַמָּה לְכָל רוּחַ בְּרִבּוּעַ. וְכֵן הַשּׁוֹבֵת בְּבִקְעָה אֲפִלּוּ הָיָה יָשֵׁן בְּשָׁעָה שֶׁנִּכְנַס הַשַּׁבָּת שֶׁלֹּא קָנָה שְׁבִיתָה יֵשׁ לוֹ לְהַלֵּךְ מִמְּקוֹמוֹ אַלְפַּיִם אַמָּה לְכָל רוּחַ בְּרִבּוּעַ. הָיָה מְהַלֵּךְ בְּבִקְעָה וְאֵינוֹ יוֹדֵעַ תְּחוּם שַׁבָּת מְהַלֵּךְ אַלְפַּיִם פְּסִיעוֹת בֵּינוֹנִיּוֹת וְזֶה הוּא תְּחוּם שַׁבָּת:
כסף משנה
4.
A person who spends the Sabbath in a barn in the desert,13The intent is a private domain that is located outside a city and that was enclosed for the purpose of dwelling, or that is less than 5000 square cubits (Rashba, as quoted by the Maggid Mishneh). (See Chapter 16, Halachah 12, and Hilchot Eruvin 7:4.)
Halachah 2 emphasizes that a person's "place" can refer to the entire city in which he lives. Similarly, in this instance, since this private domain is a distinct entity, it is considered to be the person's "place," and the calculation of a person's Sabbath limits begins from the end of its borders.
in a corral, in a cave, or in a similar type of private domain may walk through its entire space and [may continue] to the limits of a square extending two thousand cubits in every direction [from that domain].
Similarly, a person who spends the Sabbath in an [open] valley14I.e., a carmelit that is not enclosed (Chapter 14, Halachah 4). Needless to say, the same laws would apply in a public domain (Maggid Mishneh).
In this instance, the four square cubits surrounding the place where he is standing at the commencement of the Sabbath is considered his "place," and the two thousand cubits are calculated accordingly (Rashba, as quoted by the Maggid Mishneh).
may walk to the limits of a square extending two thousand cubits in every direction from the place [at which he is located at the commencement of the Sabbath]. [This applies] even when he was sleeping at the time of the commencement of the Sabbath and thus did not consciously acquire the place as his Sabbath base.15This point is the subject of a difference of opinion among our Sages (Eruvin 4:5). There are opinions that maintain that a person must consciously acquire his place on the Sabbath. Otherwise, he is allowed to move within a square of four cubits alone. Eruvin 46a substantiates the opinion that the Rambam quotes as halachah.
A person who is walking in an open valley and does not know how far his Sabbath limit extends may take two thousand ordinary steps. This is [his] Sabbath limit.

הלכה ה
הַמְהַלֵּךְ אַלְפַּיִם אַמָּה שֶׁיֵּשׁ לוֹ לְהַלֵּךְ וְשָׁלְמָה מִדָּתוֹ בְּתוֹךְ דִּיר אוֹ סַהַר אוֹ מְעָרָה אוֹ בְּתוֹךְ הַמְּדִינָה אֵינוֹ מְהַלֵּךְ אֶלָּא עַד סוֹף מִדָּתוֹ. וְאֵין אוֹמְרִין הוֹאִיל וְכִלְּתָה מִדָּתוֹ בְּתוֹךְ רְשׁוּת הַיָּחִיד מְהַלֵּךְ אֶת כֻּלָּהּ. בַּמֶּה דְּבָרִים אֲמוּרִים בְּשֶׁכָּלְתָה מִדָּתוֹ בְּמִקְצָת הָעִיר אוֹ בְּמִקְצָת הַמְּעָרָה אֲבָל אִם הָיְתָה אוֹתָהּ רְשׁוּת הַיָּחִיד מֻבְלַעַת בְּתוֹךְ אַלְפַּיִם אַמָּה שֶׁלּוֹ תֵּחָשֵׁב לוֹ כָּל אוֹתָהּ הָרְשׁוּת כְּאַרְבַּע אַמּוֹת וּמַשְׁלִימִין לוֹ אֶת הַשְּׁאָר:
כסף משנה
5.
When a person walks the two thousand cubits that he is entitled to walk and his limit ends in a barn, in a corral, in a cave, or in a city, he is allowed to proceed only to the end of his limit. We do not say that since his limit ends within a private domain, he is entitled to walk throughout that domain.16The Hagahot Maimoniot quotes sources that allow a person to proceed throughout a domain - but no further - even though his Sabbath limits end within that domain. This view is also cited by the Ramah (Orach Chayim 408:1).
When does the above apply? When his limit ends in the midst of the city or in the midst of the cave. If, however, that private domain is included within his two thousand cubits,17These concepts also apply in regard to a city. If it is included within the two thousand cubits of a person's Sabbath limits, it is only considered as four cubits. In this context, the commentaries clarify that when the urban area of a city is included within a person's two thousand cubits, but the city possesses some pasture land that extends beyond the two thousand cubits, the pasture land is not significant, and the city is still counted as four cubits (Ra'avad, as quoted by the Maggid Mishneh). that entire domain is considered to be only four cubits, and the remainder [of the two thousand cubits] is calculated accordingly.

הלכה ו
כֵּיצַד. הֲרֵי שֶׁהָיָה אֶלֶף אַמָּה מִמְּקוֹם שְׁבִיתָתוֹ אִם מִחוּץ לָעִיר עַד מְדִינָה אוֹ מְעָרָה שֶׁיֵּשׁ בְּאָרְכָּהּ אֶלֶף אַמָּה אוֹ פָּחוֹת מֵאֶלֶף מְהַלֵּךְ אֶת כָּל הַמְּדִינָה אוֹ הַמְּעָרָה שֶׁפָּגַע בָּהּ וּמְהַלֵּךְ חוּצָה לָהּ אֶלֶף אַמָּה פָּחוֹת אַרְבַּע אַמּוֹת:
כסף משנה
6.
What is implied? If there were one thousand cubits from the place a person established as his base for the Sabbath, or from the town [in which he spent the Sabbath],18In this instance, we have based our translation on Rav Kapach's Yemenite manuscripts of the Mishneh Torah, because the precise meaning of the wording employed in the standard printed text is extremely difficult to comprehend. to a city or a cave that is a thousand cubits long or less, he may walk through the entire city or cave that he encounters and [continue] beyond it for 996 cubits.

הלכה ז
אֲבָל אִם הָיָה בַּמְּדִינָה אוֹ בַּמְּעָרָה שֶׁפָּגַע בָּהּ בְּתוֹךְ מִדָּתוֹ אֶלֶף אַמָּה וְאַמָּה אֵינוֹ מְהַלֵּךְ בָּהּ אֶלָּא אֶלֶף אַמָּה בִּלְבַד שֶׁהוּא תַּשְׁלוּם אַלְפַּיִם אַמָּה שֶׁיֵּשׁ לוֹ:
כסף משנה
7.
If, however, [in the instance mentioned above,] the city or the cave that begins within his Sabbath limits extends one thousand and one cubits, the person may walk only one thousand cubits - i.e., he may proceed to the end of the two thousand cubits [granted] him, [but no further].

הלכה ח
מִי שֶׁכָּלְתָה מִדָּתוֹ בַּחֲצִי הָעִיר אַף עַל פִּי שֶׁאֵינוֹ מְהַלֵּךְ אֶלָּא עַד סוֹף מִדָּתוֹ מֻתָּר לְטַלְטֵל בְּכָל הָעִיר עַל יְדֵי זְרִיקָה. וְכֵן מִי שֶׁשָּׁבַת בְּבִקְעָה וְהִקִּיפוּהוּ נָכְרִים מְחִצָּה בְּשַׁבָּת אֵינוֹ מְהַלֵּךְ בָּהּ אֶלָּא אַלְפַּיִם אַמָּה לְכָל רוּחַ אַף עַל פִּי שֶׁהוּא בְּתוֹךְ הַמְּחִצָּה. וּמֻתָּר לוֹ לְטַלְטֵל בְּכָל הַמְּחִצָּה עַל יְדֵי זְרִיקָה אִם הִקִּיפוּהָ לְשֵׁם דִּירָה:
כסף משנה
8.
A person whose Sabbath limits end in the midst of a town may, nevertheless, move an article to any place within the town by throwing it.19Needless to say, this ruling applies when the town is surrounded by an eruv. Eruvin 42b states that it is necessary to state this law, lest one think that this would be forbidden lest a person be drawn after the article he threw.
When a person spends the Sabbath in an open valley, and gentiles surround him with an enclosure on the Sabbath, he may still walk only two thousand cubits - even when this measure is included within the enclosure - in any direction.20As stated in Chapter 16, Halachah 22, an enclosure that is erected on the Sabbath is significant - and therefore, the person is allowed to carry within it. Nevertheless, the erection of such an enclosure does not have any effect on the extent of a person's Sabbath limits, because these are established at the commencement of the Sabbath. He may, nevertheless, move an article to any place within the enclosure by throwing it, provided it was enclosed for the sake of habitation.21See Chapter 16, Halachah 1.

הלכה ט
מִי שֶׁהָיָה בָּא בַּדֶּרֶךְ לִכָּנֵס לִמְדִינָה בֵּין שֶׁהָיָה בָּא בַּיָּם בֵּין שֶׁהָיָה בָּא בֶּחָרָבָה. אִם נִכְנַס בְּתוֹךְ אַלְפַּיִם אַמָּה קָרוֹב לָעִיר קֹדֶם שֶׁיִּכָּנֵס הַשַּׁבָּת אַף עַל פִּי שֶׁלֹּא הִגִּיעַ לַמְּדִינָה אֶלָּא בְּשַׁבָּת הֲרֵי זֶה יִכָּנֵס וִיהַלֵּךְ אֶת כֻּלָּהּ וְחוּצָה לָהּ אַלְפַּיִם אַמָּה לְכָל רוּחַ:
כסף משנה
9.
[The following rule applies when] a person is in the midst of a journey - whether on sea or on dry land - and [intends] to enter a city: If he comes within two thousand cubits of the city before the commencement of the Sabbath, even though he did not arrive at the city until [after] the Sabbath [had commenced], he is permitted to enter,22This refers to a classic instance recorded in the Mishnah, Eruvin 4:2. Once, when several Rabbis were traveling together with Rabban Gamliel on a ship, they had not reached port before the commencement of the Sabbath. After the ship docked, the Sages asked Rabban Gamliel if they might disembark or not. He assured them that they might, because at the commencement of the Sabbath, he had looked to see that they were within two thousand cubits of the city. to walk throughout the entire city,23Regardless of its size, even if it is more than 2000 cubits. It is considered as if the person had already entered the city before the commencement of the Sabbath. and [continue] for two thousand cubits outside of it in all directions.

הלכה י
הָיָה בָּא לִמְדִינָה וְיָשֵׁן בַּדֶּרֶךְ וְלֹא נֵעוֹר אֶלָּא בְּשַׁבָּת וּכְשֶׁנֵּעוֹר מָצָא עַצְמוֹ בְּתוֹךְ הַתְּחוּם הֲרֵי זֶה יִכָּנֵס לָהּ וִיהַלֵּךְ אֶת כֻּלָּהּ וְחוּצָה לָהּ אַלְפַּיִם אַמָּה לְכָל רוּחַ. מִפְּנֵי שֶׁדַּעְתּוֹ הָיְתָה לְהַלֵּךְ לִמְדִינָה זוֹ וּלְפִיכָךְ קָנָה שְׁבִיתָה עִם בְּנֵי הַמְּדִינָה כְּמוֹתָן שֶׁהֲרֵי נִכְנַס עִמָּהֶן בַּתְּחוּם:
כסף משנה
10.
[The following rule applies when] a person [is in the midst of a journey and intends to enter] a city, but falls asleep on the way, and does not awake until [after] the Sabbath [has commenced]: If when he awakes, he finds himself within the city's [Sabbath] limits, he is permitted to enter, to walk throughout the entire city, and [continue] for two thousand cubits outside of it in all directions.24This also refers to a classic instance that occurred concerning Rabbi Tarfon. Eruvin 45a states that he was on his way to a city when night fell on Friday. Unsure of whether or not he was within the city limits, he did not proceed any further and spent the night in the fields. In the morning, the shepherds found him and told him, "Rabbi, the city is right in front of you. Why don't you enter?" He indeed did so, and lectured in the house of study throughout the entire day.
The Ra'avad questions why the Rambam quotes the story of Rabbi Tarfon, which is a baraita, rather than the Mishnah, Eruvin 4:4. The Mishnah states that a person who was journeying toward a city, but sat down to rest at nightfall, may enter the city on the Sabbath, if he has already passed within its Sabbath limits. Although the person was unsure whether or not he entered the Sabbath limits, since he was actually within those limits and desired to be in the city on the Sabbath, he is given the privileges of the city's inhabitants.
If, however, the person did not have a desire to be within the nearby city, or specifically stated "This is my place for the Sabbath," he may walk no more than 2000 cubits from that specific place, despite the fact that he is within the city limits. Since he consciously segregated himself from the inhabitants of the city, he is not granted their privileges (Maggid Mishneh; Shulchan Aruch and Ramah, Orach Chayim 400:1).

[This is permitted] because his intent was to journey to this city. Therefore, he is considered to have established his "place" for the Sabbath together with the inhabitants of this city, since he entered into their limits.

הלכה יא
מִי שֶׁיָּצָא חוּץ לַתְּחוּם אֲפִלּוּ אַמָּה אַחַת לֹא יִכָּנֵס שֶׁהָאַרְבַּע אַמּוֹת שֶׁיֵּשׁ לוֹ לָאָדָם תְּחִלָּתָן מִמָּקוֹם שֶׁהוּא עוֹמֵד בּוֹ. לְפִיכָךְ כֵּיוָן שֶׁיָּצָא חוּץ מִתְּחוּמוֹ אַמָּה אוֹ יֶתֶר יֵשֵׁב בִּמְקוֹמוֹ וְאֵין לוֹ לְהַלֵּךְ אֶלָּא בְּתוֹךְ אַרְבַּע אַמּוֹת מֵעֲמִידַת רַגְלָיו וְלַחוּץ. וְכֵן מִי שֶׁהֶחְשִׁיךְ חוּץ לִתְחוּם הַמְּדִינָה אֲפִלּוּ אַמָּה אַחַת הֲרֵי זֶה לֹא יִכָּנֵס לָהּ אֶלָּא מְהַלֵּךְ מִמָּקוֹם שֶׁנִּכְנַס עָלָיו הַשַּׁבָּת וְהוּא עוֹמֵד בּוֹ אַלְפַּיִם אַמָּה בִּלְבַד. וְאִם כָּלְתָה מִדָּתוֹ בְּמִקְצָת הָעִיר מְהַלֵּךְ עַד סוֹף מִדָּתוֹ כְּמוֹ שֶׁאָמַרְנוּ. הָיְתָה רַגְלוֹ אַחַת בְּתוֹךְ הַתְּחוּם וְרַגְלוֹ אַחַת חוּץ לַתְּחוּם הֲרֵי זֶה יִכָּנֵס:
כסף משנה
11.
A person who goes25This refers to a person who left the city's Sabbath limits either intentionally, for purposes not directly associated with a mitzvah, unintentionally, or because of forces beyond his control, as mentioned in the following halachah. even a single cubit beyond [a city's] Sabbath limits should not reenter them. [The rationale is that] the four cubits that a person is granted in which to walk begin from the place where the person is standing. Therefore, since the person went a cubit or more beyond his Sabbath limit, he must remain in his place. He may not walk except in the four cubits that begin from the place in which he is standing, and continue in a forward direction.26A key to the understanding of this halachah and the questions it has raised among the commentaries is the principle of הבלעת תחומים, the overlapping of boundaries. What this means is that when a person has a Sabbath limit already established, but leaves - either intentionally or because of forces beyond his control - he is given a new Sabbath limit in which he may walk. If the boundaries of that new limit overlap into his previous Sabbath limit, he may return there and walk freely within that limit.
To apply these principles to the case at hand: When a person leaves his Sabbath limits voluntarily, the place at which he stops is considered to be his base for the remainder of the Sabbath. He is granted only four cubits in which to walk. Moreover, as indicated in the notes on Chapter 12, Halachah 15, the Rambam maintains that this does not mean that the person may walk four cubits in all directions, but that he may walk four cubits in one of the four directions. Once he walks four cubits to one side, however, he may not walk four cubits in the other direction.
In the case of a person who willfully departs from the Sabbath limits, he is considered to have chosen the four cubits in front of him. Therefore, it is only within these four cubits that he may walk; he may not turn back in the direction of his original place at all.
This is the explanation given by the Maggid Mishneh for the Rambam's ruling. The Maggid Mishneh questions, however, the restriction imposed by the Rambam: Why must we say that the person is restricted to the four cubits in front of him? The person has the choice of four cubits in any direction. If he chooses the four cubits behind him, he will be able to reenter his previous Sabbath limits, and, based on the principle of הבלעת תחומים mentioned above, he would then be able to conduct himself as any other member of the city. Why prevent him from utilizing this option?
This objection - first mentioned by the Ra'avad - is echoed by Rav Yosef Karo in the Kessef Mishneh. In the Shulchan Aruch (Orach Chayim 405:1), however, Rav Karo quotes the Rambam's decision. Based on the above principles, the Magen Avraham 405:1 allows a person to return to his previous Sabbath limits if he leaves the city's Sabbath limits unintentionally or because of forces beyond his control, provided the four cubits in which he is allowed to walk overlap his previous Sabbath limits. If, however, he intentionally leaves the city's Sabbath limits, no leniency is allowed, as the Rambam states.

Similarly, a person who is even one cubit outside a city's Sabbath limits when darkness falls should not enter the city.27Since the person is outside the city's Sabbath limits, he is more than two thousand cubits away. Thus, he cannot enter the city unless he transgresses and goes beyond his own Sabbath limits. Instead, he may proceed only two thousand cubits from the place where he was standing when the Sabbath commenced. If a person's Sabbath limit ends in the midst of the city, he may proceed [no further] than the end of his Sabbath limit, as has been explained.28In Halachot 5 and 7. The Maggid Mishneh raises an obvious question: Since the person is located more than two thousand cubits outside the city, how is it possible for his Sabbath limits to end within the city? [Significantly, when quoting this law, the Shulchan Aruch (loc. cit.:3) omits this clause.]
The Maggid Mishneh answers that this refers to a situation in which a person was traveling to a city when night fell on Friday, and consciously decided to be considered as an individual, rather than as a member of the city. (See the notes on Halachah 10.)
The Kessef Mishneh explains that the Rambam is speaking of a second location, a town other than the one that the person originally desired to enter. The Or Sameach offers a unique explanation, stating that this refers to a situation where the person was more than two thousand cubits outside the city, and thus beyond its Sabbath limits. Nevertheless, there was a large cave included within his two thousand cubits. Since that cave is considered to be only four cubits, it is possible that his own Sabbath limits will extend into the city.

If one of a person's feet is inside [a city's] Sabbath limits and his other foot is outside the Sabbath limits [when the Sabbath commences], he may enter.29He may conduct himself as a member of the city with regard to its Sabbath limits. Although the Ra'avad objects to the Rambam's ruling, the Maggid Mishneh and the Shulchan Aruch (loc. cit.:2) follow the Rambam.

הלכה יב
מִי שֶׁיָּצָא חוּץ לַתְּחוּם שֶׁלֹּא לְדַעְתּוֹ כְּגוֹן שֶׁהוֹצִיאוּהוּ נָכְרִים אוֹ רוּחַ רָעָה אוֹ שֶׁשָּׁגַג וְיָצָא אֵין לוֹ אֶלָּא אַרְבַּע אַמּוֹת. חָזַר לְדַעַת אֵין לוֹ אֶלָּא אַרְבַּע אַמּוֹת. הֶחְזִירוּהוּ כְּאִלּוּ לֹא יָצָא. וְאִם נְתָנוּהוּ בִּרְשׁוּת הַיָּחִיד כְּגוֹן שֶׁנְּתָנוּהוּ נָכְרִים בַּדִּיר וְסַהַר וּמְעָרָה אוֹ בְּעִיר אַחֶרֶת יֵשׁ לוֹ לְהַלֵּךְ אֶת כֻּלָּהּ. וְכֵן אִם יָצָא לְאֶחָד מֵאֵלּוּ בִּשְׁגָגָה וְנִזְכַּר וְהוּא בְּתוֹכָן מְהַלֵּךְ אֶת כֻּלָּהּ:
כסף משנה
12.
[The following rules apply to] a person who left the Sabbath limits unintentionally - e.g., gentiles took him outside [the limits], he was possessed by an undesirable temperament,30More literally, this phrase would be rendered as "an evil spirit." Our translation is based on the Rambam's Commentary on the Mishnah (Eruvin 4:1, the source for this halachah), which interprets this phrase as referring to "any malfunction in a person's intellectual functioning, whatever the cause may be." or he inadvertently went beyond [the limit]: He may walk no more than four cubits.
If he returned [within his previous Sabbath limits] voluntarily, he may walk no more than four cubits. If [the forces that caused him to depart] returned him, it is as if he had never departed.31And he may walk within its limits at will. Note the Shulchan Aruch (Orach Chayim 405:8), which follows the ruling of Rabbenu Asher and allows a person to walk through his city at will, even if he returned voluntarily. The rationale is that since this was his original Sabbath limit, it is as though he had never departed.
If [these forces] left him in a private domain - e.g., the gentiles placed him in a barn, a corral, a cave, or another city - he may walk throughout that domain.32In this instance, we apply the principle that an entire domain can be considered to be four cubits. This ruling is the subject of a difference of opinion in the Mishnah cited above, and there are Geonim who follow the more stringent ruling and restrict the person to four cubits in this situation as well. Nevertheless, the Shulchan Aruch (Orach Chayim 405:6) and the other later authorities follow the Rambam's decision. Similarly, if he inadvertently left his Sabbath limits [and entered] a domain of this nature, and became conscious of his actions while in this domain, he may walk throughout that domain.33For Eruvin 43b equates acting without awareness of the prohibition involved to being taken away forcefully by gentiles.

הלכה יג
יָצָא חוּץ לַתְּחוּם לְדַעַת אַף עַל פִּי שֶׁחָזַר שֶׁלֹּא לְדַעַת כְּגוֹן שֶׁהֶחְזִירוּהוּ נָכְרִים אוֹ רוּחַ רָעָה אֵין לוֹ אֶלָּא אַרְבַּע אַמּוֹת. וְכֵן אִם יָצָא חוּץ לַתְּחוּם לְדַעַת אַף עַל פִּי שֶׁהוּא בְּתוֹךְ רְשׁוּת הַיָּחִיד כְּגוֹן דִּיר וְסַהַר אֵין לוֹ אֶלָּא אַרְבַּע אַמּוֹת. הַמְּפַרֵשׁ בַּיָּם הַגָּדוֹל אַף עַל פִּי שֶׁהוּא חוּץ לַתְּחוּם שֶׁשָּׁבַת בּוֹ מְהַלֵּךְ אֶת כָּל הַסְּפִינָה כֻּלָּהּ וּמְטַלְטֵל בְּכֻלָּהּ:
כסף משנה
13.
When a person voluntarily left the Sabbath limits, he may walk only within four cubits, even when he was returned to his [original] Sabbath limits involuntarily34Needless to say, according to the ruling of the Shulchan Aruch mentioned previously in Note 31, one would be allowed to walk freely in such circumstances. - e.g., he was taken back by gentiles or because of an undesirable temperament.
Similarly, if he voluntarily left the Sabbath limits, he may walk only within four cubits even when he is within a private domain - e.g., a barn or a corral.35The Maggid Mishneh relates that the Rashba differs with this decision, maintaining that, in this instance, we should also apply the principle that an entire domain can be considered to be four cubits. It is, however, the Rambam's view that is accepted by the Shulchan Aruch (Orach Chayim 405:6).
A person who sets out on the Mediterranean Sea may walk throughout the ship and carry throughout the ship, even though he is outside the Sabbath limits that he originally established as his Sabbath base.36This ruling also reflects a classic incident related by the Mishnah (Eruvin 4:1): Rabban Gamliel, Rabbi Elazar ben Azaryah, Rabbi Akiva, and Rabbi Yehoshua were on a ship that left the port of Plandarsin on the Sabbath. Rabban Gamliel and Rabbi Elazar walked throughout the ship despite the fact that it had traveled beyond their original Sabbath limits. (This follows the ruling in Halachah 12, that if gentiles take a person outside his Sabbath limits, but place him in an enclosed area, he may walk throughout the entire area. The gentiles took the Sages outside their Sabbath limits, but since the ship was enclosed, they were allowed to walk throughout its confines.)
The Mishnah continues, stating that Rabbi Akiva and Rabbi Yehoshua remained within the four cubits in which they were standing. Nevertheless, the Mishnah explains that this was merely a stringency they accepted upon themselves and not a binding obligation.
The Shulchan Aruch (loc. cit.:7) accepts the more lenient view and allows one to proceed throughout a ship's confines. It must be emphasized, however, that this leniency applies only when there are barriers around a ship's deck. When the barriers surrounding a ship's deck are removed, one may proceed throughout the ship only when it is moving. If it is anchored, the passengers may move only four cubits.

הלכה יד
מִי שֶׁיָּצָא חוּץ לַתְּחוּם שֶׁלֹּא לְדַעַת וְהֻקַּף בִּמְחִצָּה בְּשַׁבָּת יֵשׁ לוֹ לְהַלֵּךְ כָּל אוֹתָהּ הַמְּחִצָּה וְהוּא שֶׁלֹּא תִּהְיֶה יֶתֶר עַל אַלְפַּיִם אַמָּה. וְאִם הָיָה תְּחוּם שֶׁיָּצָא מִמֶּנּוּ מֻבְלָע מִקְצָתוֹ בְּתוֹךְ הַמְּחִצָּה שֶׁנַּעֲשֵׂית שֶׁלֹּא לְדַעְתּוֹ הוֹאִיל וְיֵשׁ לוֹ לְהַלֵּךְ אֶת כָּל הַמְּחִצָּה הֲרֵי זֶה נִכְנָס לִתְחוּמוֹ וְכֵיוָן שֶׁיִּכָּנֵס הֲרֵי הוּא כְּאִלּוּ לֹא יָצָא:
כסף משנה
14.
Whenever a person leaves his Sabbath limits unintentionally, and is surrounded by an enclosure on the Sabbath,37As stated in Halachah 8, and in Chapter 16, Halachah 22, an enclosure that is erected on the Sabbath is significant. Therefore, this situation is considered analogous to that of a person who leaves his Sabbath limits unintentionally and enters an enclosed domain. he may walk throughout [the area of] that enclosure, provided it does not exceed two thousand cubits.38The Rambam does not grant the person any greater leniency than if he had been located in that place when the Sabbath began, and afterwards gentiles surrounded it with an enclosure. (See Halachah 8.)
The Ra'avad and the Rashba differ and explain that greater leniency should be granted in this instance. Halachah 8 is speaking about establishing a person's place at the beginning of the Sabbath. Hence, if the enclosure is not erected at that time, it is not significant. This halachah is speaking about a person who is removed from his Sabbath limits against his will. Since we follow the principle that any enclosure is considered to be merely four cubits - whatever the size of that enclosure - he should be granted permission to walk throughout its limits, and 1996 cubits beyond it.

When this enclosure that is created without his knowledge overlaps part of the Sabbath limit that he left [an additional leniency is granted]. Since he is allowed to walk throughout that enclosure, he may reenter his Sabbath limits. Once he enters, [he may proceed freely,] as if he had never left.39In this instance as well, the Rambam is referring to a well known Talmudic incident. Eruvin 43b relates that Rav Nechemiah, one of Rav Nachman's students, had taken a Sabbath stroll, and while lost in thought had strayed beyond the Sabbath limits.
"Your student, Nechemiah, is beset by disturbance," Rav Chisda told Rav Nachman.
"Make a human partition around him [see Chapter 16, Halachah 23] and let him enter," Rav Nachman replied.

הלכה טו
כָּל מִי שֶׁאֵין לוֹ לָזוּז מִמְּקוֹמוֹ אֶלָּא בְּתוֹךְ אַרְבַּע אַמּוֹת אִם נִצְרָךְ לִנְקָבָיו הֲרֵי זֶה יוֹצֵא וּמַרְחִיק וְנִפְנֶה וְחוֹזֵר לִמְקוֹמוֹ. וְאִם נִכְנַס לְמִקְצָת תְּחוּם שֶׁיָּצָא מִמֶּנּוּ בְּעֵת שֶׁיִּתְרַחֵק לְהִפָּנוֹת הוֹאִיל וְנִכְנַס יִכָּנֵס וּכְאִלּוּ לֹא יָצָא. וְהוּא שֶׁלֹּא יָצָא בַּתְּחִלָּה לְדַעַת אֲבָל אִם יָצָא לְדַעַת אַף עַל פִּי שֶׁנִּכְנַס אֵין לוֹ אֶלָּא אַרְבַּע אַמּוֹת:
כסף משנה
15.
[The following rules apply when] any of the individuals whose movement is restricted to four cubits must relieve himself: He may leave [these four cubits], move away [an appropriate distance], relieve himself,40Note the Shulchan Aruch (Orach Chayim 406:1), which questions if this leniency applies when the person must urinate, or if it applies only when he must defecate. and then return to his place.41Here we see how important the consideration of human dignity is. Even the prohibitions of our Sages - which the Torah obligates us to fulfill - are waived because of it (Rashi, Eruvin 41b).
This would appear to indicate that, according to the Rambam - who rules that the Sabbath limit of twelve mil has its source in the Torah - a person who travels more than twelve mil beyond his Sabbath limits may not move beyond four cubits, even to relieve himself (Minchat Chinuch, Mitzvah 24).

If when moving away to relieve himself, the person enters a portion of the Sabbath limits that he originally left: since he has entered, [his] entry [is accepted as fact], and it is as though he had never departed.42The Shulchan Aruch (loc. cit.) states that one may intentionally move toward one's Sabbath limits in search of a private place to relieve oneself. Nevertheless, if such a place presents itself before one is able to return to his Sabbath limits, he must avail himself of it. He may then move far enough away so as not to be bothered by the odor, but then he must confine himself to a square of four cubits. [This leniency applies] provided he originally left unintentionally. If he left intentionally, he may walk only [within] four cubits, even if he reentered [his original limits].43As mentioned in Halachah 13, even if he was returned to his Sabbath limits by gentiles, the restrictions against his walking freely are not lifted.

הלכה טז
כָּל מִי שֶׁיָּצָא בִּרְשׁוּת בֵּית דִּין כְּגוֹן הָעֵדִים שֶׁבָּאוּ לְהָעִיד עַל רְאִיַּת הַלְּבָנָה וְכַיּוֹצֵא בָּהֶן מִמִּי שֶׁמֻּתָּר לוֹ לָצֵאת לִדְבַר מִצְוָה יֵשׁ לוֹ אַלְפַּיִם אַמָּה לְכָל רוּחַ בְּאוֹתוֹ מָקוֹם שֶׁהִגִּיעַ לוֹ. וְאִם הִגִּיעַ לִמְדִינָה הֲרֵי הוּא כְּאַנְשֵׁי הָעִיר וְיֵשׁ לוֹ אַלְפַּיִם אַמָּה לְכָל רוּחַ חוּץ לַמְּדִינָה:
כסף משנה
16.
[The following rules apply to] all individuals who are sanctioned by the court [to leave their Sabbath limits] - e.g., witnesses who are going to testify regarding their sighting of the moon,44See Hilchot Kiddush HaChodesh 3:2-4, which describes how witnesses who saw the new moon should proceed to Jerusalem to give testimony, even if it is necessary to violate the Sabbath laws. - and all others who are allowed to depart because of a mitzvah:45Rosh HaShanah 2:6 explains that this refers to individuals who leave their Sabbath limits in an attempt to save lives - e.g., a midwife or a person who goes to rescue people from drowning, from an attack, or from an avalanche, as mentioned in the following halachah. When they reach their destination, they may proceed two thousand cubits in all directions.46Rosh HaShanah (ibid.) explains that originally such people were considered to be individuals who leave their Sabbath limits voluntarily, and therefore could proceed no more than four cubits. Rabban Gamliel was the one who granted this leniency. Should they become located in a city, they [are governed by] the same [rules as] the inhabitants of that city, and may proceed two thousand cubits beyond the city in all directions.

הלכה יז
הָיָה יוֹצֵא בִּרְשׁוּת וְאָמְרוּ לוֹ וְהוּא הוֹלֵךְ בַּדֶּרֶךְ כְּבָר נַעֲשֵׂית הַמִּצְוָה שֶׁיָּצָאתָ לַעֲשׂוֹת יֵשׁ לוֹ מִמְּקוֹמוֹ אַלְפַּיִם אַמָּה לְכָל רוּחַ. וְאִם הָיָה מִקְצָת תְּחוּם שֶׁיָּצָא מִמֶּנּוּ בִּרְשׁוּת מֻבְלָע בְּתוֹךְ אַלְפַּיִם אַמָּה שֶׁיֵּשׁ לוֹ מִמְּקוֹמוֹ הֲרֵי זֶה חוֹזֵר לִמְקוֹמוֹ וּכְאִלּוּ לֹא יָצָא. וכָּל הַיּוֹצְאִין לְהַצִּיל נַפְשׁוֹת יִשְׂרָאֵל מִיַּד עוֹבְדֵי כּוֹכָבִים וּמַזָּלוֹת אוֹ מִן הַנָּהָר אוֹ מִן הַמַּפֹּלֶת יֵשׁ לָהֶם אַלְפַּיִם אַמָּה לְכָל רוּחַ מִמָּקוֹם שֶׁהִצִּילוּ בּוֹ. וְאִם הָיְתָה יַד הָעוֹבְדֵי כּוֹכָבִים וּמַזָּלוֹת תַּקִּיפָה וְהָיוּ מְפַחֲדִים לִשְׁבֹּת בַּמָּקוֹם שֶׁהִצִּילוּ בּוֹ הֲרֵי אֵלּוּ חוֹזְרִין בְּשַׁבָּת לִמְקוֹמָן וּבִכְלֵי זֵינָן:
כסף משנה
17.
[The following rules apply when] a person was sanctioned to depart [from his Sabbath limits], but in the midst of his journey, he was informed that the mitzvah that he had intended to perform had already been completed: He may proceed two thousand cubits in all directions. If a portion of the Sabbath limit from which he departed overlaps these two thousand cubits, he may return to his [original] place, and it is as though he had never departed.
All those who depart [from the Sabbath limits] to rescue Jewish lives from gentiles, from a [flooding] river, or from an avalanche, are granted two thousand cubits [in which to walk] from the place where they rescue them. [When Jews are rescued from gentiles, but] the gentiles' position is strong, and the rescuers fear spending [the remainder of] the Sabbath in the place where they rescue them, they may return to their [original] place, [carrying] their weapons.47See Chapter 2, Halachah 23, where these concepts have been explained.

זמנים הלכות שבת פרק כז
Zemanim Shabbos Chapter 27