> Can someone explain why line 2 fails (and line 3 not)? The binary() type consist of full bytes, so your binary tail has to be a multiple of 8 bits long. This works (although there might be a more elegant way): <<_:80,Val:2,_:6,_/binary>> = B. Regards, Wag -- If you pay peanuts expect monkeys to do the work.