# Sodium metal burning off when conducting electrolysis and I don't know why

I melted down some table salt and used high voltage welder power source to try and separate the sodium and chlorine it was partially successful because I could smell and see chlorine gas but during the reaction what I think was sodium would float to the top of the molten salt and burst into flame. Is there a way to prevent this?

I was thinking maybe an airtight crucible, switching the anode and cathode or keeping a lower temperature to prevent it vaporizing. Any answer would be very helpful.

First, sodium burns very nicely in air. However, it also burns in chlorine, returning back to the $$\ce{NaCl}$$ with which you started.
Most welders provide alternating current, meaning the the electrode becomes alternately positive and then negative (50 times per second [50 Hz] in much of the world, and 60 Hz in North America). Therefore, both $$\ce{Cl2}$$ gas and $$\ce{Na}$$ metal are produced at each electrode and recombining.