diff --git a/db.ddl b/db.ddl
index 48371ebd822af13a86374d380c63967d5d5bb043..f8d82738c3a715f747e9385450f46d828074b938 100644
--- a/db.ddl
+++ b/db.ddl
@@ -30,7 +30,8 @@ CREATE TABLE owl_courses (
 	ident		varchar(255)	UNIQUE NOT NULL,
 	name		varchar(255)	NOT NULL,
 	enroll_token	varchar(255)	UNIQUE NOT NULL,
-	student_grading	boolean		NOT NULL DEFAULT FALSE
+	student_grading	boolean		NOT NULL DEFAULT FALSE,
+	anon_grading	boolean		NOT NULL DEFAULT FALSE
 );
 
 CREATE TABLE owl_enroll (
diff --git a/templates/admin-course.html b/templates/admin-course.html
index 3f43893e3c3a053b21bb59a4165d4826d56db6e6..df1cd538631e56e091f66ad349383a1f8d7963d4 100644
--- a/templates/admin-course.html
+++ b/templates/admin-course.html
@@ -7,7 +7,7 @@
 		<tr><th>Name<td>{{ g.course.name }}
 		<tr><th>Enroll token<td><code>{{ g.course.enroll_token }}</code>
 		<tr><th>Teachers<td>{{ teachers|sort|join(', ') }}
-		<tr><th>Student grading<td>{{ 'enabled' if g.course.student_grading else 'disabled' }}
+		<tr><th>Student grading<td>{{ 'enabled' if g.course.student_grading else 'disabled' }}{% if g.course.anon_grading %} (anonymous){% endif %}
 	</table>
 
 	<div class=buttons>
diff --git a/templates/admin-courses.html b/templates/admin-courses.html
index d0e139f049a397a937cb607e530b496210e562e8..eb1b7298a9c146b39e17c73b8e99abb7bd65a615 100644
--- a/templates/admin-courses.html
+++ b/templates/admin-courses.html
@@ -18,7 +18,12 @@
 		{% else %}
 			<td>–
 		{% endif %}
-		<td>{{ 'yes' if c.student_grading else 'no' }}
+		<td>
+		{% if c.student_grading %}
+			{{ 'anonymous' if c.anon_grading else 'yes' }}
+		{% else %}
+			no
+		{% endif %}
 	{% endfor %}
 	</table>
 
diff --git a/templates/topic-grade.html b/templates/topic-grade.html
index 83ec78f98172890c5fac2814b95e9f57bf6ab451..c68fee8562a3a5fe92e7f27e0a55389fc8abce37 100644
--- a/templates/topic-grade.html
+++ b/templates/topic-grade.html
@@ -10,12 +10,17 @@
 
 	<h3>Grade {{t.title}}</h3>
 		<table class=results>
-			<tr><th class='tbeforehdr'>Full name
+			<tr><th class='tbeforehdr'>Name
 			<th>Points
 			<tr><th class='tbeforehdr'>max.
 			<td class='pts'>{{ t.max_points if t.max_points != None else "" }}
 		{% for s in students.values() %}
-			<tr><td class='tbeforehdr'>{{ s.full_name }}
+			<tr><td class='tbeforehdr'>
+				{% if c.anon_grading and s.uid != g.uid %}
+					Student {{ s.uid }}
+				{% else %}
+					{{ s.full_name }}
+				{% endif %}
 				{% set sol=solutions[s.uid] %}
 				{% set cls=[] %}
 				{% if sol.last_activity == None %}
diff --git a/templates/topic.html b/templates/topic.html
index 656ba39f4310bf0f4641477637c2172277711700..ab369817efc1e2ffe196aee485fee140c224ca1b 100644
--- a/templates/topic.html
+++ b/templates/topic.html
@@ -39,7 +39,12 @@
 	{% endif %}
 
 	<div id=p{{ p.pid }} class='{{ cls | join(" ") }}'>
-		<p class=phdr>{{ p.author_name }} —
+		<p class=phdr>
+		{%- if g.course.anon_grading and not g.is_teacher and p.author_uid != g.uid and p.author_uid == student_uid -%}
+			Student {{student_uid}} —
+		{% else -%}
+			{{ p.author_name }} —
+		{% endif -%}
 		{% if p.modified != None %}
 			{% set when=p.modified %}
 			modified