Positive commandment · Mitzvat Aseh #73 of 613
Confession of sin
להתוודות לפני ה' מכל חטא שיעשה האדם, בשעת הקרבן ושלא בשעת הקרבן
The verse · Bamidbar 5:7
וְהִתְוַדּוּ אֶת־חַטָּאתָם אֲשֶׁר עָשׂוּ וְהֵשִׁיב אֶת־אֲשָׁמוֹ בְּרֹאשׁוֹ וַחֲמִישִׁתוֹ יֹסֵף עָלָיו וְנָתַן לַאֲשֶׁר אָשַׁם לוֹ
“then they shall confess their sin which they have done: and he shall make restitution for his trespass in full, and add to it its fifth part, and give it to him against whom he has trespassed.”
The Rambam’s words
For a person to confess before G-d for any sin which he has committed. [This applies] when he brings a sacrifice [for atonement] and when he does not bring a sacrifice, as [Numbers 5:6] states: "And they shall confess the sins that they committed." the Rambam defines this mitzvah as return to G-d and repentance, a more encompassing service, of which confession is only one facet.(See Hilchot Teshuvah 2:2.)
להתוודות לפני ה' מכל חטא שיעשה האדם, בשעת הקרבן ושלא בשעת הקרבן, שנאמר: "והתוודו, את חטאתם אשר עשו" (במדבר ה,ז).
Why · Sefer HaChinuch #364
Confession of sin
“It is from the roots of this commandment [that it is] because through the verbal admission of iniquity, the sinner reveals his thoughts and opinion: that he truly believes that all his deeds are revealed and known before G-d, blessed be He, and that he will not act as if ‘the Eye that sees’ does not see.”
Who & when
“And this commandment is practiced in every place and at all time by males and females.”
Where in the Mishneh Torah
Hilchot Repentance הלכות תשובה