For an orthogonal basis $(u_i)$, $[v]_B$ has entries $c_i=\langle u_i,v\rangle/\|u_i\|^2$. If the basis is orthonormal, the denominator is one. These formulas follow by taking the inner product of $v=\sum_ic_iu_i$ with each $u_j$. They require $v$ to lie in the spanned space.