You can do this with one line, but you need to create a mod (or edit one that you already have) in %UserProfile%\Documents\Paradox Interactive\Crusader Kings II\mod.
1. You could create a folder in there called "CharID" -> and inside one called "localisation" -> and inside a text file with this text:
CHARACTER_TOOLTIP_DELAYED;[GetStatusInfo]\nID: §Y[GetID]§!;;;;;;;;;;;;;x
2. You can save it as "CharID.csv"
3. Then you can go back to the mod folder (%UserProfile%\Documents\Paradox Interactive\Crusader Kings II\mod), and create a text file with this text:
name = "CharID"
path = "mod/CharID"
4. You can save it as "CharID.mod"
5. Then all you need to do is enable CharID in the launcher.
If you want to skip all of this, I've attached a file you can extract to your mod folder (stated above).
If you want more than just the character ID to appear, then this is what I use (from CK2Plus):
CHARACTER_TOOLTIP_DELAYED;Dynasty: §Y[GetOnlyDynastyName]§!\nCulture: §Y[Culture.GetName]§!\nReligion: §Y[Religion.GetName]§!\n[GetStatusInfo]\nID: §Y[GetID]\n§![GetTributaryPeriod];;;;;;;;;;;;;x
This adds dynasty, culture, religion, character ID, and tributary period.