I planned to wait to tell my boss until I was 12 weeks, but morning sickness meant that it needed to be moved way up. I waited until our first ultrasound, then spilled the beans. My boss was aware of our early loss, as I had to take a few days off work, so I'm not sure if that contributed to his reaction, but he was totally, 100% supportive! He gave me a hug, asked how I was feeling, and let me know that while he's totally happy for me, he wanted to be sure to remind me that he's still a guy and may not "get" everything that's going on with me, so if there was ever a time he was being a "dolt" to just tell him. Since then he's been extremely accommodating to the few times
Everyone else at my office has been awesome as well. I've been here a little over 3 years, and everyone's really excited that I'm expecting. When food is brought into the office, I'm invited to partake, and they ask if any particular smells are bothering me. I had a coworker give me her yogurt when I was needing a snack, and that same coworker is already planning a baby shower. It's been a really pleasant surprise and I very much appreciate my coworkers and their kindness.
I know not everyone is as fortunate, so I definitely can't advise anyone else when to tell their boss, but I'm glad I'm not trying to keep it a secret anymore.