Mostly no: standard window glass blocks the UVB rays your skin needs to make vitamin D, so sitting in a sunny room will make little or none.
Why glass gets in the way
Your skin makes vitamin D when it's hit by UVB, a type of ultraviolet light. Ordinary window glass absorbs most UVB, though it lets through UVA, the type linked to tanning and skin aging. So you can feel warm and even get some skin damage from UVA indoors, yet make almost no vitamin D. Car windows, office windows and most home windows behave this way. This is well established physics, and studies of people who spend their days behind glass (for example, in nursing homes) support it.
A few details:
- Some specialty glass or very thin glass may let through slightly more UVB, but not enough to rely on.
- Sunscreen, clothing, darker skin, age, and being far from the equator in winter all reduce vitamin D production further, even outdoors.
What does work
- Sun outdoors: Short, regular time outside with some skin exposed can produce vitamin D, but how much depends on your latitude, season, time of day, skin tone and age. There's no single time that suits everyone, and sunburn risk matters, so it's sensible to balance this against skin-cancer guidance.
- Food: Few foods are rich in vitamin D. From the USDA data (per 100 g):
| Food | Vitamin D |
|---|---|
| Farmed Atlantic salmon, raw | 11 µg |
| Canned sardines in oil, drained, with bone | 4.8 µg |
| Whole egg, raw | 2 µg |
| White mushrooms, raw | 0.2 µg |
A 3 oz (85 g) portion of salmon works out to roughly 9 µg, which is a big share of the commonly cited adult recommendation of 15 µg (600 IU) a day, though needs vary by age and country. Egg vitamin D is in the yolk, and amounts vary with the hen's diet. Mushrooms are low as sold here, though some are exposed to UV light during growing, which raises their vitamin D considerably. Check the label for those.
- Fortified foods and supplements: Many milks, plant milks and cereals have vitamin D added. Supplements are a common option for people with limited sun, and the research generally supports them for raising blood levels.
When to check with a professional
If you rarely get outdoors, have darker skin and live far from the equator, are older, have a condition affecting fat absorption, or are pregnant or breastfeeding, ask a doctor or registered dietitian whether a blood test or supplement makes sense. Very high supplement doses can be harmful, so it's best not to guess.