Deductions & credits

So my annual income was reduced by the amount I put into a HSA, however then I am required to put in box 12 letter W my contribution and the employers contribution to the HSA.  When I insert the amount in box 12 letter W it reduces my tax refunds.  I thought HSA was supposed to be non taxed but it looks like it is actually just taxed at end of year.  What am I missing?