A sealing material for optical elements with excellent transparency, crack resistance, and heat resistance which can produce a cured product of the sealing material and a sealed optical element are provided. The sealing material for optical elements comprising a compound with a ladder structure, which contains a repeating unit of the following formula (A) in the molecule as a major component, the compound being obtained by condensing a compound (1) shown by the formula, R1Si(OR3)P(X1)3-p, and a compound (2) shown by the formula, R2Si(OR4)q(X2)3-q, at a molar ratio of 1:9 to 10:0 in the presence of a phosphoric acid catalyst,
wherein R1 represents a group having a reactive functional group, R2 represents an alkyl group having 1 to 20 carbon atoms, R3 and R4 individually represents an alkyl group having 1 to 6 carbon atoms, X1 and X2 individually indicate a halogen atom, p and q individually represent an integer from 0 to 3, and l, m, and n individually represent 0 or an arbitrary integer, provided that l and n are not 0 at the same time.