**TLDR:** In all cases, the student definitely should be one of the authors. In most cases, I would argue for him to be the first author, but there are definitely many variables that should be considered. ---------- For me, personally, the most important argument for giving first authorship to the student is that there is a huge power differential in favor of the advisor. The student is usually unsure of the academic conventions and will likely accept whatever the advisor says (if only to make his life easier). Making them the first author ensures, that the student will not feel that someone unjustly benefited from their work. I actually turned my MSc. thesis into a paper. In the first draft, I put myself as a third author of the paper (my advisor and my consultant from another department came before me). As no one had any comment, I kept it that way and in retrospect, I feel a little regret about it. I have recently co-authored a paper in computer science (currently under review) with my BSc. student. The student has written the software, designed and performed evaluation of the software with human subjects and performed analysis - all after relatively heavy consultations with me. I have written the text of the paper (reusing literature research from the BSc thesis), extended the evaluation and re-analysed the complete dataset. I gave the student first authorship, although the student that he was initially reluctant (claiming that I had written the paper and brought in ideas) and I am very happy about the decision, as I think it encouraged the student to think of himself as a scientist, although he does not want to pursue academic career.