If it is a libp2p-key under your control, you can get them directly:
ipfs id --peerid-base base36 (self key used for your PeerID)
ipfs key list -l --ipns-base base36 (all IPNS keys)
Third-party PeerIDs that start with Qm.. (RSA keys):
ipfs cid format -v 1 -b base36 --codec libp2p-key QmLegacyPeerIDInBase58 (upgrade legacy PeerID encoded as a Multihash in Base58 to self-describing CIDv1 with libp2p codec)
Third-party PeerIDs that start with 12... (inlined ED25519) were added recently and working with them is bit awkward at the moment. Such PeerID notation is not a CIDv0, so can’t update them to CIDv1 with ipfs cid, but with go-ipfs 0.10.0+ this should work (thx @adin):