It is an object to provide a flexible semiconductor device bearing a memory device with a highly reliable storage function, where the memory device comprises a layer containing an organic compound. Specifically, the memory device has a memory element which comprises a layer including an organic compound between a pair of electrodes and a sealing layer formed over the memory element, and a moisture absorbing material is contained in the sealing layer. As the moisture absorbing material, a particle of molten silica, crystalline silica, alumina, silicon nitride, aluminum nitride, boron nitride, zeolite, an oxide of an alkaline earth metal, sulfate or a high water-absorbing polymer can be used.