Inflammation and apoptosis are regulated by similar factors, including ultraviolet B (UVB) radiation and cannabinoids, which are metabolized by cyclooxygenase-2 (COX-2) into pro-apoptotic prostaglandin derivatives. Thus, the aim of this study was to evaluate the impact of cyclooxygenase-2 inhibition by celecoxib on the apoptosis of keratinocytes modulated by UVB, anandamide (AEA) and cannabidiol (CBD). For this purpose, keratinocytes were non-treated/treated with celecoxib and/or with UVB and CBD and AEA. Apoptosis was evaluated using microscopy, gene expressions using quantitate reverse-transcriptase polymerase chain reaction; prostaglandins using liquid chromatography tandem mass spectrometry and cyclooxygenase activity using spectrophotometry. UVB enhances the percentage of apoptotic keratinocytes, which can be caused by the increased prostaglandin generation by cyclooxygenase-2, or/and induced cannabinoid receptor 1/2 (CB1/2) expression. AEA used alone intensifies apoptosis by affecting caspase expression, and in UVB-irradiated keratinocytes, cyclooxygenase-2 activity is increased, while CBD acts as a cytoprotective when used with or without UVB. After COX-2 inhibition, UVB-induced changes are partially ameliorated, when anandamide becomes an anti-apoptotic agent. It can be caused by observed reduced generation of anandamide pro-apoptotic derivative prostaglandin-ethanolamide by COX. Therefore, products of cyclooxygenase-dependent lipid metabolism seem to play an important role in the modulation of UVB-induced apoptosis by cannabinoids, which is particularly significant in case of AEA as inhibition of cyclooxygenase reduces the generation of pro-apoptotic lipid mediators and thus prevents apoptosis.