The IFC specification was devised a methodology to compress the standard GUIDs to conserve space, you can find detailed instructions at buildingSMART IFC GUID.But there is no direct way to get the standard GUID or IFC-GUID in Revit.

Sample ID


GUID (Length:36) :c71cffa8-2bb5-4842-bd34-f25c022e8f00

Revit UniqueID (Length:45) : c71cffa8-2bb5-4842-bd34-f25c022997b1-000718b1

Revit ElementID (Length:Unsized) : 465073

IFC GlobalID (Length:22) : 377F_eAxL8Ghqqybm2Bey0

Conversion diagram


Conversion diagram

and the C# version implementation.

public static Guid ToGuid(string uniqueId)
{
    if (uniqueId.Length != 45)
    {
        throw new Exception("the given string isn't revit unique id");
    }
    int elementId = int.Parse(uniqueId.Substring(37), NumberStyles.AllowHexSpecifier);
    int tempId = int.Parse(uniqueId.Substring(28, 8), NumberStyles.AllowHexSpecifier);
    int xor = tempId ^ elementId;
    return new Guid(uniqueId.Substring(0, 28) + xor.ToString("x8"));
}

You can find also find the conversion diagram between IFC GlobalID and standard GUID sample at https://github.com/Zhuangkh/IDConverter.

public static Guid FromIfcGuid(string guid)
public static string ToIfcGuid(Guid guid)