Exported GMail mbox contains GMail labels

Just in case it isn’t already common knowledge: The “Takeout” export of GMail will give you a single file in mbox format (which will be rather large).

That file contains the content of the “all mail” folder. And each of the messages in the file has a header like this:

X-Gmail-Labels: Archived,Important,Rechnung

So with the right tool it is possible to restore the labels you have set in GMail. Unfortunately I know of no such tool. And also I don’t know of any (Windows) email client that allows you to set user defined tags for emails.

EDIT: There is a tool called Google Takeout Data Converter that claims to do that. I haven’t tested it though.

EDIT2: Thunderbird apparently supports custom tags, not just the ones that are predefined.

EDIT3: Thunderbird also supports virtual folders e.g. based on tags.