A crystal oscillator that outputs an oscillation output signal of an oscillator circuit oscillated by a crystal resonator as a resonation source via a buffer circuit, includes: a plurality of waveform output circuits provided in the buffer circuit, each converting, when inputted, the oscillation output signal into a different waveform and outputting the converted signal; a circuit selection switch that selects any one of the plurality of waveform output circuits as a waveform output circuit of the buffer circuit; and a memory circuit that stores data used by the circuit selection switch to select any one of the waveform output circuits.