This paper presents algorithms for computing the length of a sum of squares and a Pythagoras element in a global field $K$ of characteristic different from $2$. In the first part of the paper, we present algorithms for computing the length in a non-dyadic and dyadic (if $K$ is a number field) completion of $K$. These two algorithms serve as subsidiary steps for computing lengths in global fields. In the second part of the paper we present a procedure for constructing an element whose length equals the Pythagoras number of a global field, termed a Pythagoras element.