Do I have to go to confession before receiving the Eucharist?

Anyone who is conscious of grave sin may not celebrate Mass or receive the Body of the Lord without first obtaining sacramental absolution; however, if there is a serious reason and no opportunity to find a confessor, he should remember that he is obliged to make an act of perfect contrition, which includes the intention of confessing as soon as possible.

Can. 916