I will typically do this on a phone screen, having informed the candidate beforehand that they need to be near a computer with an internet connection during the call. Typically this will be after business hours, so they're at home where they're comfortable, and on their own machine, whatever it is.
I use a site called rextester to administer the test. I've been using it for years, and it's fantastic.
As the tester, you go to the site, choose the language, and click 'live cooperation' at the bottom. Then you email or tell the candiate the link to follow, and both of you click on it to go to the shared coding editor. You can now see the candidate type and talk about how they're solving the problem, editing yourself to give hints/clarity if need be. To save time, you can have some code handy to paste in and pre-seed the problem if you choose (like a list of data to sort, etc.)
This tool has proven immensely useful in my interview process, and beats the hell out of whiteboard coding in person, IMHO.
[edit - spelling]