Novice here: YouTube song and record my voice

I’m a novice and so far I’m unable to find an answer to my question.
Can I take a song from YouTube and record it on Audacity and then record my voice into that recording? Rather like singing Karaoke but it can be recorded?
If so, how do I do this or where can I find the instructions on how to do this?
Thanks,
Lconover

Windows 8.1; Audacity 2.6.0; not sure if I’ve obtained the .exe installer or the zip.
Thanks,
lconover

OK, so there’s two parts to this question.

Firstly, recording sounds that are playing on your computer (for example in your web browser): Audacity Manual
Note that YouTube videos can be downloaded directly, which avoids having to record it, so it is quicker and better sound quality to download rather than record. Use your favourite search engine to find out how to download from YouTube.
In order to import the audio from the downloaded video, you will need to have FFmpeg installed. See here for how to do that: Audacity Manual
Note that many songs on the Internet are subject to copyright restrictions, so downloading or recording them may not be legal. I’m not a lawyer, but the advice is to check the copyright terms before downloading or copying.

The second part is called “overdubbing”. See: Audacity Manual

If you want to record your vocals without the vocals of the original recording, it is sometimes possible to remove the lead vocals from the recording. To do this relies on the lead vocal being dead centre of the stereo mix, and all other instruments being panned left/right in the mix. Sometimes you can be lucky and find a mix like this and then vocal removal will work reasonably well. More often than not, these requirements are not met and vocal removal does not work. In these cases you will need to find a karaoke version that has been made without the lead vocal. See here about vocal removal: Audacity Manual