---
title: "GIFT Format for Moodle: Syntax, Examples and Import Steps | Formswrite Blog"
description: "Learn Moodle GIFT format with a worked example for every question type, feedback, partial credit, the characters you must escape and how to import the file."
canonical: https://formswrite.com/blog/gift-format-moodle-guide
last-updated: 2026-10-08
---

# GIFT Format for Moodle: Syntax, Examples and Import Steps

In short

GIFT (General Import Format Technology) is a plain-text format for writing Moodle quiz questions. Each question is the question text followed by the answers inside curly braces: a correct answer starts with an equals sign, a wrong one with a tilde, and feedback follows a hash sign.

This guide gives a working example of every common question type, the characters that break a file, and the import steps.

## The basic pattern

text`// A comment line, ignored on import ::Capital of France::What is the capital of France? {   ~Madrid   =Paris #Correct.   ~Rome #Rome is the capital of Italy.   ~Berlin }`

-   `::Capital of France::` is the optional question title.
-   The question text comes next, then an opening brace.
-   `=` marks the correct answer, `~` marks a wrong one.
-   `#` starts feedback for that answer.
-   A closing brace ends the question, and a blank line separates it from the next one.

## One example per question type

### Multiple choice with several correct answers

Give each answer a percentage. The positive weights must add up to 100.

text`Which of these are prime numbers? {   ~%50%2   ~%50%5   ~%-100%4   ~%-100%9 }`

### True/false

For true/false, the first feedback (after the first hash) shows when the student answers wrongly and the second when they answer correctly.

text`The Earth orbits the Sun. {TRUE#The Earth does orbit the Sun.#Correct, once a year.}  Water boils at 50 degrees Celsius at sea level. {FALSE#Check the boiling point again.#Correct, it boils at 100 degrees Celsius.}`

### Short answer

Every accepted spelling gets an equals sign.

text`What is the capital of Italy? {=Rome =rome}`

### Matching

text`Match each country to its capital. {   =Canada -> Ottawa   =Italy -> Rome   =Japan -> Tokyo }`

### Numerical

text`What is the value of pi to two decimal places? {#3.14:0.01}  How many days are in a leap year? {#366}`

The number after the colon is the accepted tolerance. A range is written `{#365..366}`.

### Missing word

text`Moodle is an open-source {~spreadsheet =learning management system ~browser} used by schools.`

### Essay

An empty pair of braces makes an essay question that a teacher grades by hand.

text`Describe one advantage of formative assessment. {}`

## Characters you must escape

GIFT uses a few characters as syntax. Put a backslash before any of these when they appear in the question or answer text:

| Character | Why it is special | Write it as |
| --- | --- | --- |
| ~ | Starts a wrong answer | \~ |
| = | Starts a correct answer | \= |
| # | Starts feedback | \# |
| { and } | Open and close the answer block | \{ and \} |
| : | Part of the title and weight markers | \: |

Maths in the form `a = b` inside a question is the most common accidental trigger, so escape the equals sign there.

## Categories and format options

A line that begins with `$CATEGORY:` puts all following questions into that category:

text`$CATEGORY: Unit 3/Fractions`

To use HTML in a question, add a format marker before the text, for example `[html]`. That is how a GIFT file can link to an image by URL, but it cannot carry an image file inside it. If you need embedded images, use Moodle XML. Our comparison of [Aiken, GIFT and Moodle XML](/blog/moodle-aiken-vs-gift-vs-xml) lays out the differences.

## How to import a GIFT file into Moodle

1.  Save the file as a plain text file with UTF-8 encoding.
2.  Open your course, then the Question bank.
3.  Choose Import and select GIFT format.
4.  Upload the file, choose the target category and click Import.
5.  Read the result page. Moodle lists each question it created and flags every line that failed, so correct those and import again.

## Generate the GIFT file instead of typing it

If your questions are in a Word file, PDF, Google Doc or spreadsheet, Formswrite can read the questions, options and correct answers and export a GIFT file ready to import. Its Moodle exports also include Aiken and Moodle XML. The free plan allows only Formswrite Forms as an export, so GIFT and the other LMS exports need a paid plan. An account itself is free.

[Export a document to Moodle](/product/documents-to-moodle)

If your quiz only uses single-answer multiple choice, the [Aiken format converter](/tools/aiken-format-converter) is simpler. For a quiz in several systems at once, a [QTI package](/blog/qti-format-explained) is the portable choice.

## FAQ

What does GIFT stand for in Moodle?

GIFT stands for General Import Format Technology. It is one of the text formats built into Moodle for importing questions into the question bank, alongside Aiken and Moodle XML.

How do I give partial credit in GIFT?

Put a percentage between tildes and the answer text, such as ~%50%Answer. For a question with several correct answers, the positive percentages should add up to 100, and wrong answers can carry a negative percentage so guessing is penalised.

Why did my GIFT import fail on a question that looks fine?

Look for an unescaped special character such as an equals sign, hash, tilde or brace inside the text, a missing closing brace, or a missing blank line between questions. Curly quotes pasted from Word can also cause trouble, so retype them as plain quotes.

Can I put images in a GIFT file?

Only by linking to an image that is already online with an HTML question. GIFT cannot embed the image itself. Use Moodle XML if you want images included in the file.
