> For the complete documentation index, see [llms.txt](https://overleaf-pro.ayaka.space/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://overleaf-pro.ayaka.space/latex/knowledge-base/068-how-to-insert-figures-in-overleaf.md).

# How to insert figures in Overleaf

Overleaf provides 3 ways to create LaTeX figures:

1. Use the [**Insert Figure** button](#using-insert-figure-to-add-a-figure-to-your-project) (![The Insert Figure button on the editor toolbar](/files/B1pcH75kPuP9jTgswYuY)) to insert a figure into **Visual Editor** or **Code Editor**.
2. [Copy and paste an image](/latex/knowledge-base/075-how-to-paste-formatted-content-into-overleaf.md#pasting-images-into-your-overleaf-project) into **Visual Editor** or **Code Editor**.
3. Use **Code Editor** to write LaTeX code that [inserts a graphic and places it inside a figure environment](/latex/more-topics/27-inserting-images.md).

Options 1 and 2 automatically generate the LaTeX code required to create your figure, but if you’re a confident LaTeX user you might prefer option 3 which provides the most flexibility. If you’re new to LaTeX then option 1, the **Insert Figure** button (the focus of this page), is a great way to get started.

Before using any of these figure-creation methods, make sure your main LaTeX file has loaded the `graphicx` package by writing `\usepackage{graphicx}` within its [preamble](/latex/latex-basics/01-learn-latex-in-30-minutes.md#the-preamble-of-a-document).

## Using Visual Editor and Code Editor

Before we explain how to insert a figure, it’s worth noting **Visual Editor**’s figure preview feature.

Figures can be inserted into **Visual Editor** or **Code Editor**, but only **Visual Editor** provides a preview of the figure together with a button which opens a modal window allowing you to make changes. The following brief video clip demonstrates **Visual Editor**’s figure preview feature.

{% embed url="<https://videos.ctfassets.net/nrgyaltdicpt/4ohFnejYVn89OUj2fAbJ6F/18ad3cd10b0b3ceb7955cc651c92eedb/VisualEditorDemo.mp4>" %}

## Using Insert Figure to add a figure to your project

Use the following steps to insert a figure into an Overleaf LaTeX document.

1. Choose which editor you want to use: **Visual Editor** or **Code Editor**.
2. Select the **Insert Figure** button (![The Insert Figure button on the editor toolbar](/files/B1pcH75kPuP9jTgswYuY)) to display a list of options for inserting figures:

   ![List of options for inserting a figure](/files/6m0ZOBEnFnOl8aiHPTcW)
3. Use the following document links to jump to the option of interest:

* [Upload from computer](#upload-from-computer)
* [From project files](#from-project-files)
* [From another project (video demo)](#from-another-project)
* [From URL (video demo)](#from-url)

### Upload from computer

This option creates a figure using a graphics file uploaded from your device.

![The upload from computer modal displayed when you upload a file](/files/BFjMtgOskMDxtWJuZpKJ)

To use this option:

1. Upload a graphic using one of these methods:

* drag and drop a graphics file onto the modal window (within the area shown)
* paste an image into the modal window (within the area shown)
* manually select a file located on your device

3. Give the graphics file a name.
4. (Optional) Choose a project folder in which to save the file.
5. Decide whether to use a figure caption.
6. Decide whether to include a label (used for [referencing the figure](/latex/more-topics/27-inserting-images.md#labels-and-cross-references)).
7. Set the image width (as a fraction of `\linewidth`).
8. Select **Insert figure** to upload the graphic and automatically generate a LaTeX `figure` environment based on your choices.

### From project files

This option creates a figure using one of the graphics files previously uploaded to your current project.

![The insert from project files modal used to select a project file for creating a figure](/files/wnV1TVEGYtnBE74Cai4C)

To use this option:

1. Choose a graphic contained in your project.
2. Decide whether to use a figure caption.
3. Decide whether to include a label (used for [referencing the figure](/latex/more-topics/27-inserting-images.md#labels-and-cross-references)).
4. Set the image width (as a fraction of `\linewidth`).
5. Select **Insert figure** to automatically generate a LaTeX `figure` environment based on your choices.

### From another project

This option creates lets you create figures using graphics files contained in another one of your Overleaf projects. As shown in the animated sceenshot below, you select a project then choose a file previously *uploaded* to that project, or a file *output* (generated) by that project—for example, a PDF graphic generated by [externalizing TikZ graphics](https://learn.overleaf.com/learn/Questions/I_have_a_lot_of_tikz,_matlab2tikz_or_pgfplots_figures,_so_I%27m_getting_a_compilation_timeout._Can_I_externalise_my_figures%3F#How_to_externalize_TikZ_graphics). See the section [Select from output files](#select-from-output-files) for a video clip showing how to use an output file created by another project.

![An animated GIF showing how to choose file generated by another project](/files/fVrWLvOI731hCKH8oSAp)

To use this option:

1. Choose a project containing graphics files you’d like to use in your current project.
2. Select one of that project’s graphics:
   * an **image file** *uploaded to* that project, or
   * an [**output file**](#select-from-output-files) *generated by* that project.
3. Give the graphics file a name.
4. (Optional) Choose a project folder in which to save the file.
5. Decide whether to use a figure caption.
6. Decide whether to include a label (used for [referencing the figure](/latex/more-topics/27-inserting-images.md#labels-and-cross-references)).
7. Set the image width (as a fraction of `\linewidth`).
8. Select **Insert figure** to automatically generate a LaTeX `figure` environment based on your choices.

#### Select from output files

The video clip below walks you through the process of incorporating a figure into your current project, utilizing a file generated from another project that creates [externalized TikZ graphics](/latex/questions-and-answers/60-i-have-a-lot-of-tikz-matlab2tikz-or-pgfplots-figures-so-i-m-getting-a-compilation-timeout.-can-i.md#how-to-externalize-tikz-graphics).

{% embed url="<https://videos.ctfassets.net/nrgyaltdicpt/1hcdCRW7PFioG58vexEMpf/60b86288419fea290ad4b43a633afda3/FigureFromExternalProjectFile.mp4>" %}

### From URL

This option lets you create figures using graphics added (downloaded) to your project via a URL.

![An image showing the modal window for downloading a file via a URL](/files/JUCtAJvzy9ao60UJphkN)

To use this option:

1. Paste a [direct download link](https://en.wikipedia.org/wiki/Direct_download_link) (URL) into the **Image URL** field.
2. Give the graphics file a name.
3. (Optional) Choose a project folder in which to save it.
4. Decide whether to include a figure caption.
5. Decide whether to include a label (used for [referencing the figure](/latex/more-topics/27-inserting-images.md#labels-and-cross-references)).
6. Set the image width (as a fraction of `\linewidth`).
7. Select **Insert figure** to automatically generate a LaTeX `figure` environment based on your choices.

The following video clip demonstrates using a [Google Drive download URL](/latex/knowledge-base/051-how-can-i-upload-files-from-google-drive.md). It also shows how to change the figure size and give it a caption.

{% embed url="<https://videos.ctfassets.net/nrgyaltdicpt/29hcjGmsEQewhuCVQaWkSr/2cef229050a36a87b86dc0aabdde2858/InsertFigureURL.mp4>" %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://overleaf-pro.ayaka.space/latex/knowledge-base/068-how-to-insert-figures-in-overleaf.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
