A realistically shaped three-dimensional single-neuron model was constructed for each of four principal cell types in the neocortex in order to infer their contributions to magnetoencephalography (MEG) and electroencephalography (EEG) signals. For each cell, the soma was stimulated and the resulting intracellular current was used to compute the current dipole Q for the whole cell or separately for the apical and basal dendrites. The magnitude of Q is proportional to the magnetic field and electrical potential far from the neuron. A train of spikes and depolarization shift in an intracellular burst discharge were seen as spikes and an envelope in Q for the layer V and layer II/III pyramidal cells. The stellate cells lacked the envelope. As expected, the pyramidal cells produced a stronger Q than the stellate cells. The spikes produced by the layer V pyramidal cells (n = 4) varied between -0.78 and 2.97 pA m with the majority of the cells showing a current toward the pia (defined as positive). The basal dendrites, however, produced considerable spike currents. The magnitude and direction of dipole moment are in agreement with the distribution of the dendrites. The spikes in Q for the layer V pyramidal cells were produced by the transient sodium conductance and potassium conductance of delayed rectifier type; the conductances distributed along the dendrites were capable of generating spike propagation, which was seen in Q as the tail of a triphasic wave lasting several milliseconds. The envelope was similar in magnitude (-0.41 to -0.90 pA m) across the four layer V pyramidal cells. The spike and envelope for the layer II/III pyramidal cell were 0.47 and -0.29 pA m, respectively; these values agreed well with empirical and theoretical estimates for guinea pig CA3 pyramidal cells. Spikes were stronger for the layer IV spiny stellate (0.27 pA m) than the layer III aspiny stellate cell (0.06 pA m) along their best orientations. The spikes may thus be stronger than has been previously thought. The Q for a population of stellate cells may be weaker than a linear sum of their individual Q values due to their variable dendritic geometry. The burst discharge by pyramidal cells may be detectable with MEG and EEG when 10 000-50 000 cells are synchronously active.