Oxygen is #8 on the periodic table. The first electron reservoir can contain 2 electrons; Two, eight. Therefore, from 8 electrons, 2 go to the first Shell and 6 to the second; Valence electrons are the ones that are in the outermost layer (there are some exceptions, but they are much lower in the table).
Remember H2O. Hydrogen has only 1 electron, which is used to form chemical bond in the water molecule. Thus, 2 hydrogen atoms lend 1 electron each to complete the outer layer of oxygen, it must contain exactly 8 electrons for the molecule to be stable, then 8 (must have)-2 (from 2 hydrogen atoms) = 6 (oxygen itself).
Oxygen has 6 valence electrons, because it’s electron configuration is 1s^2 2s^2 2p^4. To determine valence electrons, add the outermost s and p orbitals.
In an oxygen atom, 8 electrons are present.
Electron present in the first shell (n=1) 2n^2=2(1)^2=2(1)=2
Electron present in the second shell(n=2) =2(2)^2=2(4)=8
In oxygen, the remaining electrons is only 6 electrons.
Therefore, no of electrons in outer shell= no of electrons in valence shell= 6
electronic configuration = 1s2 2p6