Home › Moodle XML Format

Moodle XML Format: Structure, Example, and Import Steps

Updated October 25, 2026 · 8 min read

Moodle imports questions three ways — XML, GIFT, and Aiken. GIFT and Aiken are plain text and quick to hand-write, but they cannot carry everything. Moodle XML is the expressive format: it supports categories, per-answer feedback, hints, multiple correct answers, and question types beyond multiple-choice. This is the deep-dive — structure, a working example, and when to reach for it.

The three formats at a glance

FormatTypeBest forCan carry feedback/hints?
XMLMarkupRich, structured banksYes — fully
GIFTPlain textBulk MCQ / short answerPartly (inline)
AikenPlain textSimple MCQ onlyNo

XML anatomy

Every Moodle XML file is a <quiz> root holding one or more <question> elements. Each question declares its type and contains:

A working example

This imports as one multiple-choice question with correct-answer feedback:

<?xml version="1.0" encoding="UTF-8"?>
<quiz>
  <question type="multichoice">
    <name><text>Addition basics</text></name>
    <questiontext format="html">
      <text>What is 2 + 2?</text>
    </questiontext>
    <answer fraction="100">
      <text>4</text>
      <feedback><text>Correct.</text></feedback>
    </answer>
    <answer fraction="0">
      <text>3</text>
    </answer>
    <answer fraction="0">
      <text>5</text>
    </answer>
    <hint><text>Count up from 2.</text></hint>
  </question>
</quiz>

Import steps

1

Open the question bank

In your course, go to More → Question bank → Import (or a category's Import).

2

Choose XML

Select "XML" as the import format.

3

Upload the .xml

Pick your file and click Import. Moodle parses and reports any item it could not read.

4

Preview

Check the imported questions in the bank before adding them to a quiz.

When XML beats GIFT and Aiken

Reach for XML when you need categories (organize questions into the bank tree), per-answer feedback, hints, multiple correct answers (multichoice with more than one right option), or non-MCQ types like matching, essay, or calculated. For a fast batch of plain multiple-choice, GIFT or Aiken is less verbose — but you give up that metadata.

Generating XML from a spreadsheet

You do not have to hand-write XML. A fixed-column spreadsheet — Question, options, Correct, Explanation — can be transformed into Moodle XML, carrying categories, feedback, and hints from columns. That keeps XML's expressiveness without its typing burden. Our Moodle import guides are at examparser.com/blog/en.

Frequently asked questions

What are Moodle's three import formats?

Moodle imports questions from XML, GIFT, and Aiken. XML is the most expressive (categories, multi-answer, feedback, hints, question types). GIFT is a compact plain-text format good for bulk multiple-choice and short-answer. Aiken is the simplest plain-text format for multiple-choice only. All three reach the same question bank; they differ in how much metadata they can carry.

When should I use Moodle XML instead of GIFT or Aiken?

Use XML when you need anything the plain-text formats cannot express: question categories, per-answer feedback, hints, multichoice with multiple correct answers, or non-MCQ types like matching and essay. For a quick batch of plain multiple-choice, GIFT or Aiken is faster to hand-write. XML is the right call when structure and feedback matter.

What is the minimum valid Moodle XML for one question?

A <quiz> root containing one <question type="multichoice"> with a <name>, a <questiontext>, and one or more <answer> elements carrying a fraction (100 for correct, 0 for wrong) and the answer text. Wrap it in the standard XML declaration and it imports cleanly.

How do I import Moodle XML?

In Moodle, go to the Question bank for a course or category, choose 'Import', select 'XML' as the format, upload the .xml file, and click Import. Preview the parsed questions afterward; Moodle reports any item it could not parse.

Can I generate Moodle XML from a spreadsheet?

Yes. A fixed-column spreadsheet (question, options, correct answer, explanation) can be transformed into Moodle XML programmatically, or by a converter that outputs the format. That avoids hand-writing XML while keeping its expressiveness — categories, feedback, and hints can all be carried from columns.

Build a rich Moodle bank without hand-writing XML

Keep questions in a fixed-column spreadsheet and convert them to Moodle XML — categories, feedback, and hints included.

Try ExamParser →