Encode tools

Convert data between representations.