We classify 5d N=1 gauge theories carrying a simple gauge group that can arise by mass-deforming 5d SCFTs and 6d SCFTs (compactified on a circle, possibly with a twist). For theories having a 6d UV completion, we determine the tensor branch data of the 6d SCFT and capture the twist in terms of the tensor branch data. We also determine the dualities between these 5d gauge theories, thus determining the sets of gauge theories having a common UV completion.