There are two customs as to when the berakha over the candles is recited. Some say it prior to lighting, as the rule for all mitzvot is to recite the berakha before performing the mitzva. Thus, they first say “Barukh ata Hashem Elokeinu Melekh ha-olam, asher kideshanu be-mitzvotav ve-tzivanu lehadlik ner shel Shabbat” (“Blessed are You, Lord our God, King of the universe, Who sanctified us with His mitzvot and commanded us to light Shabbat candles”) and then light. This is the ruling of Shulĥan Arukh and the custom of some Sephardic women (SA 263:5; Yabi’a Omer 2:16).
Others recite the berakha after lighting because according to several poskim women accept Shabbat by invoking it in the berakha, and therefore one who recites the berakha before lighting will not subsequently be allowed to light (Behag). To be sure, according to most poskim as long as a woman has in mind that she is not accepting Shabbat when reciting the berakha she may light the candles afterward. Nevertheless, women did not want to light the candles after reciting the berakha and invoking Shabbat. For this reason, the widespread custom in most communities is that women first light the candles and afterward recite the berakha, thereby accepting Shabbat. Many Aĥaronim affirmed and reinforced this custom. Nevertheless, in order to follow the general rule of reciting a berakha before doing a mitzva, women customarily cover their eyes while reciting the berakha and only then open their eyes and enjoy the light of the candles. This is the custom of all Ashkenazim (Rema 263:5) and some Sephardim (Maĥzik Berakha [Ĥida] 263:4, Ben Ish Ĥai, Year Two, No’aĥ 8). This was also the custom in Morocco, Iraq, and elsewhere. In practice, every woman should follow the custom of her mother’s family.
When a single man or a widower lights candles, he should make the berakha before lighting. This is because the custom of men is to accept Shabbat verbally after the Minĥa prayers, not at the time of candle lighting (SSK 43:30).