calculate tag size on server side instead of client side