---
title: "Moodle XML Rules: Question Types, Grades and Images"
description: "The rules a Moodle XML file must follow to import cleanly: the quiz root, question types, answer fractions, cloze, images, and what Formswrite exports."
canonical: https://formswrite.com/formats/moodle-xml
last-updated: 2026-11-06
---

Moodle XML rules

# What a Moodle XML file needs before it goes in the question bank

Moodle XML is the most complete way to move questions into Moodle, and the least forgiving when it is wrong. Drop your file here to see every question, its type and what will change.

[Fix it in Formswrite](/accounts/signup?source=formats-moodle-xml)[Check a file](#check)

## The short version

A Moodle XML file is one <quiz> element with a <question> per question, each carrying a type attribute such as multichoice, truefalse, shortanswer, numerical, essay, matching or cloze. Grades live on each answer as a fraction, so the file holds the answer key, partial credit and feedback in one place.

Files exported by Moodle itself almost always import. Files written by hand, by a script or by another tool are where trouble starts: a root element that is not <quiz>, a question type the importer does not know, numerical tolerances, or images that point at files that are not in the XML.

The rules below also say what Formswrite’s Moodle XML reader does with a file: which questions become fill in the blank, which matching distractors are dropped and which types are skipped.

The checker on this page runs that reader on your file and lists each question with its type and what will change.

## Check your Moodle XML file

Drop a .xml or .zip file here, or choose one. It is read in memory to build the report and never stored.

Choose a file[Fix it in Formswrite](/accounts/signup?source=formats-moodle-xml)

unit-3-questions.xml

```
<?xml version="1.0" encoding="UTF-8"?>
<quiz>
  <question type="multichoice">
    <name><text>Q001 Which are prime numbers?</text></name>
    <questiontext format="html">
      <text><![CDATA[<p>Which are prime numbers?</p>]]></text>
    </questiontext>
    <defaultgrade>1.0</defaultgrade>
    <penalty>0.0</penalty>
    <shuffleanswers>1</shuffleanswers>
    <single>false</single>
    <answernumbering>none</answernumbering>
    <answer fraction="50"><text>2</text></answer>
    <answer fraction="50"><text>7</text></answer>
    <answer fraction="-33.33333"><text>9</text></answer>
  </question>
</quiz>
```

What the file contains

## What a Moodle XML file contains

One <quiz>, an optional category question that names the folder, then a question per question. This is how Formswrite writes a checkbox question.

1.  ### <quiz> root
    
    Required. A file whose root is anything else is not a Moodle XML quiz file.
    
2.  ### type attribute
    
    Decides how the question is read: multichoice, truefalse, shortanswer, numerical, essay, matching, cloze or description.
    
3.  ### answer fraction
    
    The grade for that answer in percent. 100 is right, 0 is wrong, negative values take marks away.
    
4.  ### single
    
    true for one right answer, false for checkboxes where the fractions add up to 100.
    

## Moodle XML import rules

Each rule comes from the code that reads and writes Moodle XML files in Formswrite. "Will not import" loses the question or the file, "Changes on import" alters it, "How it is read" is good to know.

1.  Will not import
    
    ### The root element is <quiz>.
    
    Any other root is refused with "This is not a Moodle XML quiz file".
    
    Fix: Export from the question bank in Moodle XML format, not GIFT or a backup .mbz.
    
2.  Changes on import
    
    ### Question types are multichoice, multichoiceset, truefalse, shortanswer, regexp, numerical, essay, matching, cloze or description.
    
    Calculated, drag and drop and other plugin types are skipped and listed by name in the import warnings.
    
    Fix: Rebuild those questions in Moodle, or rewrite them as multiple choice before you export.
    
3.  Changes on import
    
    ### Numerical questions with a tolerance accept only the exact value here.
    
    The question imports as a short answer that accepts the exact number, and the import warnings say so.
    
    Fix: Set the tolerance again in the target platform, or turn it into multiple choice.
    
4.  Changes on import
    
    ### Matching questions have one answer per item.
    
    Extra wrong answers with no item of their own are left out, because Formswrite matching has one answer per item.
    
    Fix: Turn distractors into items, or accept that they are dropped.
    
5.  How it is read
    
    ### Cloze (embedded answers) questions use the {1:SHORTANSWER:=answer} syntax.
    
    Each embedded answer becomes one blank whose accepted answers are its 100% answers. A cloze that cannot be parsed falls back to a short answer.
    
    Fix: Check the braces and colons in each embedded answer.
    
6.  How it is read
    
    ### Description questions are instructions, not questions.
    
    They are kept as text between questions and do not count toward the total.
    
    Fix: Nothing to fix.
    
7.  How it is read
    
    ### A category question names the quiz.
    
    The last part of the first category path becomes the title, unless it is "top" or "Default".
    
    Fix: Export from the category you want the quiz named after.
    
8.  Changes on import
    
    ### The first image of a question is in a base64 <file>, an http link or a data URI.
    
    Images Moodle wrote as @@PLUGINFILE@@ are read from the file element. One that cannot be read is skipped and the import warnings say so.
    
    Fix: Export with the files included, or host the image and link it.
    
9.  Changes on import
    
    ### Formswrite gives the first accepted short answer 100% and any others 0%.
    
    Alternative spellings are in the file but earn no marks until you change them.
    
    Fix: In Moodle, edit the question and set the other answers to 100%.
    
10.  Will not import
     
     ### A short answer with no key is exported with "\*" as its answer.
     
     "\*" is Moodle’s wildcard, so any response gets full marks.
     
     Fix: Set the accepted answers in the editor before you export.
     
11.  How it is read
     
     ### Checkbox questions split 100% across the right answers and take 33.33% off for each wrong one.
     
     Guessing every box scores less than picking the right ones.
     
     Fix: Change the penalty per answer in Moodle if your school marks differently.
     
12.  How it is read
     
     ### Dropdown questions export as multichoice and date questions as shortanswer.
     
     Moodle has no dropdown or date type in a quiz, so these are the closest equivalents.
     
     Fix: Nothing to fix.
     
13.  How it is read
     
     ### Formswrite embeds question images in the XML as data URIs.
     
     The file is self contained, with no separate image folder to lose.
     
     Fix: Nothing to fix. Expect a larger file when questions have photos.
     
14.  Will not import
     
     ### The XML declares no entities and has no inline DTD.
     
     A file with an <!ENTITY> declaration or an internal DTD subset is refused for security. A plain DOCTYPE line pointing at a public DTD is fine.
     
     Fix: Export again from the platform. Hand edited files sometimes pick up a DTD block from a template.
     
15.  Will not import
     
     ### The XML is well formed.
     
     An unclosed tag, a stray ampersand or a broken CDATA block stops the whole file from being read.
     
     Fix: Open the file in a code editor that flags XML errors, or export it again instead of editing by hand.
     
16.  Will not import
     
     ### The file is 10 MB or smaller.
     
     A larger file is refused before a single question is read.
     
     Fix: Export the bank in two parts, or take large images out of the package and add them back in the platform.
     
17.  Changes on import
     
     ### Every question has text (or an image) and the parts its type needs.
     
     A choice question with no options, an ordering question with fewer than 2 items or a matching question with no pairs is skipped and counted in the import warnings.
     
     Fix: Fill in the missing options or pairs in the platform before you export, or delete the empty question.
     
18.  Changes on import
     
     ### At most 1,000 questions per file.
     
     Only the first 1,000 usable questions are read, and the import warnings say how many the file had.
     
     Fix: Split a very large bank by unit or category and check each file on its own.
     

## Question types in Moodle XML

Kept means it arrives as it was. Changed means a close equivalent. Fix first means an edit in the Formswrite editor before you export. Left out means the file has no place for it.

| Question type | From a Moodle XML file | In the Formswrite Moodle XML export |
| --- | --- | --- |
| Multiple choice | multichoice with single true. | Keptmultichoice, single true, 100 for the right answer and 0 for the rest. |
| Multiple answers | multichoice with single false, or multichoiceset. | Keptmultichoice, single false, 100 split across the right answers. |
| True or false | truefalse. | Changedmultichoice with True and False options. |
| Short answer and fill in the blank | shortanswer and regexp with every accepted answer. | Keptshortanswer, the first answer at 100%. |
| Essay and paragraph | essay. | Keptessay. |
| Numerical answer | numerical, exact value only. | Changedshortanswer with the number as the answer. |
| Matching | matching, one answer per item. | Fix firstNot written as matching. Rebuild it in Moodle. |
| Ordering (puzzle, jumble) | Not a core Moodle XML type, skipped. | Fix firstWritten as shortanswer. Rewrite it first. |

## How to import a Moodle XML file

1.  Pip
    
    ### Check the file here
    
    Drop the .xml in the checker. Fix the errors first, especially short answers with no key.
    
2.  Nova
    
    ### Open the question bank
    
    In your Moodle course open More, then Question bank, and choose Import.
    
3.  Rio
    
    ### Pick Moodle XML format
    
    Select Moodle XML, upload the file, and choose whether to take the category from the file.
    
4.  Kiki
    
    ### Add the questions to a quiz
    
    Moodle imports into the bank, not the quiz. Open the quiz, choose Add, then From question bank.
    

## Move a quiz in or out of Moodle XML

-   ### Moodle to Canvas
    
    Convert a Moodle question bank to Canvas: upload the Moodle XML, fix the one question type Canvas cannot take, then download a Canvas QTI .zip.
    
    [Open the converter about Moodle to Canvas](/convert/moodle-to-canvas)
    
-   ### Moodle to Google Forms
    
    Convert a Moodle question bank to Google Forms: upload the Moodle XML, fix the one question type Google Forms cannot take, then get a self grading Google Form.
    
    [Open the converter about Moodle to Google Forms](/convert/moodle-to-google-forms)
    
-   ### Moodle to Kahoot
    
    Convert a Moodle question bank to Kahoot: upload the Moodle XML, fix the 4 question types Kahoot cannot take, then download Kahoot's quiz spreadsheet.
    
    [Open the converter about Moodle to Kahoot](/convert/moodle-to-kahoot)
    
-   ### Moodle to QTI
    
    Convert a Moodle question bank to QTI: upload the Moodle XML, fix the one question type QTI cannot take, then download a QTI 2.1, 2.2 or 1.2 package.
    
    [Open the converter about Moodle to QTI](/convert/moodle-to-qti)
    
-   ### Canvas to Moodle
    
    Convert a Canvas quiz to Moodle: upload the Canvas QTI .zip, fix the one question type Moodle cannot take, then download Moodle XML.
    
    [Open the converter about Canvas to Moodle](/convert/canvas-to-moodle)
    
-   ### QTI to Moodle
    
    Convert a QTI package to Moodle: upload the QTI package, fix the 2 question types Moodle cannot take, then download Moodle XML. The answer key comes with it.
    
    [Open the converter about QTI to Moodle](/convert/qti-to-moodle)
    
-   ### Google Forms to Moodle
    
    Convert a Google Form to Moodle: pick the form from Drive, fix the one question type Moodle cannot take, then download Moodle XML.
    
    [Open the converter about Google Forms to Moodle](/convert/google-forms-to-moodle)
    

## Questions people ask

Is Moodle XML better than GIFT?

For anything beyond simple questions, yes. Moodle XML carries images, feedback, partial credit and every core type. GIFT is quicker to type by hand.

Why does every answer get full marks?

A short answer exported with no key gets "\*" as its answer, which Moodle treats as a wildcard. Set the accepted answers before export. The rules below mark this as an error.

Does Formswrite read Moodle XML backups?

No. A course backup (.mbz) is a different format. Export the questions from the question bank as Moodle XML instead.

Can I check a file another teacher sent me?

Yes. Drop it in the checker. It is read in memory and nothing is stored.

## Keep reading

-   [Documents to MoodleTurn a Word file, PDF or Google Doc into Moodle XML.](/product/documents-to-moodle)
-   [Moodle XML format exampleA complete file with every core question type, annotated.](/blog/moodle-xml-format-example)
-   [GIFT format converterThe plain text Moodle format, with rules and a converter.](/tools/gift-format-converter)
-   [Aiken format converterThe simplest Moodle import for multiple choice only.](/tools/aiken-format-converter)

## Make a clean Moodle XML file from your document

Upload a Word file, PDF or Google Doc, check the questions and the key in the editor, then export. Exports other than Formswrite Forms need a paid plan.

[Fix it in Formswrite](/accounts/signup?source=formats-moodle-xml)[How the export works](/product/documents-to-moodle)
