How do I replace the toilet shutoff valve?
That looks like a 1/2" copper pipe with the valve soldered on. Definitely check it with a magnet before trying to wrench it off. 

If it is copper and you are not handy with soldering, you could replace it fairly easily using a valve with a compression fitting inlet:  



You will have to carefully cut the pipe behind the existing valve, and use steel wool and/or some emery cloth to clean up that oxidation/corrosion on the copper pipe.

My personal preference is to solder a threaded male adapter onto the pipe and using a new threaded supply valve with 1/2" FIP inlet: