You can use PowerShell command to export the term store in SharePoint 2013 into CSV file, and then import to SharePont Online.
Besides, the pitfall of importing CSV file , you can't specify child-parent relationship between term sets.
More information and PowerShell command check the article: [PowerShell for SharePoint 2013: Export TermSet to CSV] [PowerShell for SharePoint 2013: Export TermSet to CSV]:
Migrate SharePoint 2010 Term Store to SharePoint Online with PowerShell