The Shulchan Arukh codifies the mourning customs during the Omer period — forbidding haircuts, weddings, and certain joyful activities — and notes that some communities cease mourning after Lag BaOmer, based on the tradition that Rabbi Akiva's students stopped dying on that day.
דינים הנוהגים בימי העומר. ובו ד סעיפים: נוהגים שלא לישא אשה בין פסח לעצרת עד ל"ג בעומר מפני שבאותו זמן מתו תלמידי ר' עקיבא אבל לארס ולקדש שפיר דמי ונשואין נמי מי שקפץ וכנס אין עונשין אותו: הגה מיהו מל"ג בעומר ואילך הכל שרי (אבודרהם וב"י ומנהגים): נוהגים שלא להסתפר עד ל"ג לעומר שאומרים שאז פסקו מלמות ואין להסתפר עד יום ל"ד בבוקר אלא אם כן חל יום ל"ג ערב שבת שאז מסתפרים בו מפני כבוד השבת: הגה ובמדינות אלו אין נוהגין כדבריו אלא מסתפרין ביום ל"ג ומרבים בו קצת שמחה ואין אומרים בו תחנון (מהרי"ל ומנהגים) ואין להסתפר עד ל"ג בעצמו ולא מבערב (מהרי"ל) מיהו אם חל ביום א' נוהגין להסתפר ביום ו' לכבוד שבת (מהרי"ל) מי שהוא בעל ברית או מל בנו מותר להסתפר בספירה לכבוד המילה (הגהות מנהגים):
It is customary not to get married between Pesach and Shavuot, until Lag BaOmer (the 33rd day), because during that time, the students of Rabbi Akiva died. However, to do "erusin" and "kiddushin" (engagement and betrothal) is OK. And even for "nisuin" (marriage), if someone did so, we do not punish him. Rema: however, from Lag Ba'Omer onwards, all this is permitted (Abudraham, Beit Yosef & Minhagim). It is customary not to cut one's hair until Lag BaOmer, since it is said that that is when they stopped dying. One should not cut one's hair until the 34th day, in the morning, unless the 33rd day falls on Friday, in which case one may cut one's hair then, in honor of the Sabbath ("kavod Shabbat"). Rema: But in these countries, we do not follow the custom he advocates; rather, we cut our hair on the 33rd day, and we rejoice a bit, and we do not say Tachanun (Maharil and Minhagim). And one should only cut one's hair on the 33rd day itself, but not on its evening. However, if it falls on Sunday, our custom is to cut our hair on Friday in honor of the Sabbath (Maharil). Someone who is performing a brit milah (i.e., the sandak, mohel and the infant's father), or circumcizing his son, is allowed to cut his hair during sefirah in honor of the circumcision (Hagahot Minhagim).