Question: does hit by pitch count towards on base percentage

Answer: Yes, In baseball statistics, on-base percentage (OBP; sometimes referred to as on-base average/OBA, as the statistic is rarely presented as a true percentage) is a statistic generally measuring how frequently a batter reaches base. Specifically, it records the ratio of the batter's times-on-base (TOB) (the sum of hits, walks, and times hit by pitch) to their number of plate appearances. It first became an official MLB statistic in 1984.