Yes, you can take magnesium and any of the B vitamins together. There is no competition between these two nutrients to get absorbed by the body, so one will not cancel out the other. Taking these nutrients together may be more effective than taking either one alone. Both are neuroprotective - they protect nerve cells from damage and promote better, more efficient cognitive function.