Hansen was born in Fountain Valley, California and raised in El Cajon, California, but has since moved with his wife Amy to Los Angeles.
Hansen began acting with guest starring roles on series such as Grounded for Life, That's So Raven, and Las Vegas. In 2004, Hansen auditioned for the role of Duncan Kane on Veronica Mars but lost out to Teddy Dunn. However, Rob Thomas told him to try out for the role of Dick Casablancas.
In 2008, Hansen appeared in Superhero Movie and in the Christian Community Theater original musical Alice as Trevor McKnight/White Night. The show opened on July 31 and ran through August 10, in San Diego.
In 2011, Hansen portrayed Ben Lewis on the NBC sitcom Friends with Benefits. In 2012, he began a recurring role as Andy, the candy shop owner, on the CBS sitcom "2 Broke Girls". The same year he had a supporting role in the film Hit and Run alongside Dax Shepard (husband of Kristen Bell) and Bradley Cooper.
He also played Kyle Bradway on the Starz television show Party Down. In 2012 he appeared as a recurring character on 2 Broke Girls. Hansen also has a recurring role as bad boy contestant Blaze on the web series Burning Love. Most recently, he reprised the role of Dick Casablancas in the Veronica Mars movie.
Hansen and his wife, Amy, were former roommates of actress Kristen Bell at her house in the Hollywood Hills. Together, they have two children.
Hansen is involved in the Invisible Children Campaign and has appeared in the online series The LXD, of which 50% of the profits is going to Invisible Children.