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]:https://gallery.technet.microsoft.com/office/PowerShell-for-SharePoint-a838b5d0