How are chess PGN or FENs generated?

Sort:
jdkfjs

If I had a set of moves for black and white, how could I generate a FEN or PGN? Are there any online generators currently available? I need to know how to implement it in code though...

KeSetoKaiba

Just put the moves or position into chess.com Analysis board and then bottom right there is a "Share" button. From here, you can copy the FEN or PGN. Learning how to write FEN or PGN by hand is fairly easy to learn too and it is really useful. 

I also made a video on FEN several months ago. I'll put it here, but I will also probably have to revisit that topic in the future as I've upgraded microphone since then and perhaps with a webcam or other diagrams etc. it would be easier to follow along, but this is still decent enough for now if you are curious and have no idea where FEN string comes from.