This is a phrase that you use to show that the last thing you said wasn't true.
People sometimes tell small lies to trick each other, and then say "Just kidding!" to reveal the trick:
A: Can I borrow a piece of paper?
B: That'll be five dollars. Just kidding... here you go.
Kids often use "Just kidding." It's used in casual speech, and not common in writing.