A complete understanding of neuronal functions requires observation of the synapse with high spatial and temporal resolution. Recently, we developed a method to combine optogenetics with electron microscopy to capture dynamic changes in synaptic morphology during neurotransmission. First we generated transgenic C. elegans animals expressing channelrhodopsin in specific neurons. We stimulated these neurons in intact animals using a home-built light stimulation device and modified specimen holders for the Leica EM Pact2 high-pressure freezer. Samples were subsequently frozen 20 ms after the light stimulus. We demonstrated that synaptic vesicle fusion intermediates could be captured using this technique. This method can be readily applied to other light-activatable molecules, such as caged compounds, light-switchable ligands, and photoactivatable proteins, to study dynamic changes in cells.