Like saying good morning in Korean, saying good night has different levels of formality depending on who you are talking to.
안녕히 주무세요 (an-nyeong-hi ju-mu-se-yo)
For saying good night formally, I use this often with my mother and father in law and if taken for its literal meaning, it means to sleep peacefully.
However, if you are not close to a Korean family, or a Korean who is significantly older than you, you may rarely use this phrase. It is still a good thing to know.
잘 자요/잘 자 (jal ja-yo/jal ja)
For the second phrase, you would use this as a standard good night, and you can drop the (요) for people you are really close to. For example family, romantic relationships, and people younger than you.
You would never say this to someone older than you as it is quite rude. If you are new to Korean, they might give you a free pass, but it’s still better to learn the formal way and remember it.
These are both pretty simple and easy to learn, and are phrases you can use immediately with your Korean friends.
For the past tense of both:
Formal – 안녕히 주무셨어요 (an-nyeong-hi ju-mu-shyeo-sseo-yo)
Standard/Casual – 잘 자요/잘 자 (jal ja-yo/jal ja)