Spatiotemporal regulation of axonal branching and elongation is essential in the development of refined neural circuits. cAMP is a key regulator of axonal growth; however, whether and how intracellular cAMP regulates axonal branching and elongation remain unclear, mainly because tools to spatiotemporally manipulate intracellular cAMP levels have been lacking. To overcome this issue, we utilized photoactivated adenylyl cyclase (PAC), which produces cAMP in response to blue-light exposure. In primary cultures of dentate granule cells transfected with PAC, short-term elevation of intracellular cAMP levels induced axonal branching but not elongation, whereas long-term cAMP elevation induced both axonal branching and elongation. The temporal dynamics of intracellular cAMP levels regulated axonal branching and elongation through the activation of protein kinase A (PKA) and exchange protein directly activated by cAMP (Epac), respectively. Thus, using PAC, our study for the first time reveals that temporal cAMP dynamics could regulate axonal branching and elongation via different signaling pathways.