The Shulhan Aruch (Orah Haim 3:10) writes – based on the Gemara in Masechet Berachot (62) – that when one cleans himself after defecating, he should use specifically his left hand. The Gemara brings several reasons for this rule. One reason is that people ordinarily eat with their right hand, so it would be inappropriate to use the same hand for cleaning oneself. A second reason is that one uses his right hand when writing Torah matters. Another reason is that in the synagogue, the person signaling the cantillation notes for the Torah reader uses his right hand. Others explain this rule based on the Torah's description of G-d having given us the Torah with His "right," as it were ("Mi'ymino Esh Dat Lamo" – Debarim 33:2). Finally, one uses his right hand to wrap Tefillin around his left arm, and so this hand should not be used also for cleaning oneself.
Even when cleaning with the left hand, one should not use the middle finger, as the Tefillin is wrapped around that finger.
The Poskim debate the question of whether these laws apply to women, who do not wear Tefillin, and do not write Torah or signal to the Torah reader. Rav Yisrael Bitan concludes that it is proper for women to abide by this Halacha. When it comes to left-handed individuals, most of the reasons given in the Gemara would require them to do just the opposite – to use the right arm. The exception is the reason associating this practice with Hashem's having given the Torah with His "right." Regardless, the general consensus among the Poskim is that a left-handed person should clean himself with his right hand.
A number of Poskim – including Rav Yaakov Emden (Germany, 1697-1776) and the Eshel Avraham (Rabbi Avraham David Wahrman of Buchach, 1771-1840) – maintained that this entire discussion applies only when one cleans himself with his bare hand. In ancient times, people did not necessarily have materials with which to clean themselves, and so they would sometimes use their bare hands. The Gemara thus established that it would be inappropriate to use the right hand for this purpose, as it would come in direct contact with excrement. Today, however, when people use paper, and the fingers do not directly touch the excrement, one may use either hand. This is the implication also of the comments of Rav Shneur Zalman of Liadi (founding Rebbe of Lubavitch, 1745-1812). Rav Shlomo Gantzfried (Ukraine, 1804-1886), in his Kisur Shulhan Aruch, disputed this view, asserting that in Talmudic times, too, people used materials to clean themselves and did not use their bare hands. Likewise, the Birkat Yehuda argued that since the Gemara makes no mention of such a distinction, we must assume that this Halacha applies regardless of whether one cleans with a material or with his bare hand. Rav Yisrael Bitan refuted this argument, noting that in Talmudic times, even when people used materials to clean themselves, it was all but inevitable that their fingers would directly touch the excrement in the process. When one uses modern-day toilet paper, however, this does not happen, and so it might be permissible to use the right hand.
The Sitz Eliezer (Rav Eliezer Waldenberg, Jerusalem, 1915-2006) followed the lenient opinion, and allowed cleaning oneself with either hand if he uses paper. Hacham David Yosef, in Halacha Berura, writes that if one finds it difficult to clean with his right hand, he may use his left hand.
It must be emphasized that the highest priority is that the cleaning is thorough. As we've discussed, Halacha forbids learning Torah, praying or reciting Berachot if even a small amount of excrement is on the body, and thus one must ensure to clean himself thoroughly. According to all opinions, if cleaning with the left hand will compromise one's ability to clean himself properly, then he should use his right hand.
Rav Yisrael Bitan writes that it stands to reason that this applies also when cleaning an infant in the process of changing a diaper, as there seems to be no reason to distinguish between cleaning oneself and cleaning somebody else. However, Rav Bitan adds, this would apply only when the child has begun eating solid foods. When a child only drinks milk, the bodily waste is not halachically regarded as filth, and we may thus assume that he can be cleaned with either hand. Once the child begins eating solid food, however, cleaning the infant should be no different than cleaning oneself, and the aforementioned Halacha should thus apply. Of course, since baby wipes are normally used, one who wishes may rely on the leniency noted above permitting the use of either hand if there is no direct contact with the excrement.
The Poskim write that this entire discussion relates specifically to cleaning excrement. It is permissible to use either hand to kill an insect, to take out the garbage, and even to wipe drops of urine that had fallen on one's skin. Likewise, a plumber may use either hand when opening and repairing sewage pipes.
Summary: A person should preferably use his left hand to clean himself after defecating, but should avoid using the middle finger of his left hand. A left-handed person should use his right hand and avoid using the middle finger on that hand. This applies also when cleaning somebody else, such as when changing an infant's diaper. However, some Poskim maintain that this entire discussion does not apply nowadays, when people clean themselves with paper and do not come in direct contact with excrement, and one who wishes may rely on this leniency. The most important consideration is ensuring that one cleans himself thoroughly.

