---
title: "Discussion on \"How to store an image to a database with React using Base 64.\" | Hashnode"
description: "Discussion on \"How to store an image to a database with React using Base 64.\". The easiest guide for encoding and decoding images using base64."
url: "https://hashnode.com/posts/how-to-store-an-image-to-a-database-with-react-using-base-64/609b660100bbde79d86a57d6"
---

[Feed](https://hashnode.com/feed) /

Discussion

# [How to store an image to a database with React using Base 64.](https://yemmyharry.hashnode.dev/how-to-store-an-image-to-a-database-with-react-using-base-64?utm_source=hashnode&utm_medium=feed)

The easiest guide for encoding and decoding images using base64.

May 12, 2021 · 4 min read · yemmyharry.hashnode.dev  
Read the article

-   [#reactjs](https://hashnode.com/tag/reactjs)
-   [#nodejs](https://hashnode.com/tag/nodejs)
-   [#express](https://hashnode.com/tag/express)
-   [#mongodb](https://hashnode.com/tag/mongodb)

## Written by

[Yemi Arigbanla](https://hashnode.com/@yemmyharry)

@yemmyharry

  
[View profile](https://hashnode.com/@yemmyharry)

Software Developer

I am a fullstack developer

## Responses 3

Markdown supported · ⌘↵ to post

[Vivek Gautam](https://hashnode.com/@vivekgautamj)

[May 13, 2021](https://hashnode.com/posts/how-to-store-an-image-to-a-database-with-react-using-base-64/609b660100bbde79d86a57d6/comment/609cc085b684eb4cd52c310e)

Great Article , But I think saving the url of the image will be clean and better way of using it .

-   Get the image from client
-   Make some changes in naming / compress it (or use any third party to compress)
-   Save images in S3 using multer , it will return image url
-   Save image url in mongoDB

[Halil Irmak](https://hashnode.com/@tenclouds)

[May 12, 2021](https://hashnode.com/posts/how-to-store-an-image-to-a-database-with-react-using-base-64/609b660100bbde79d86a57d6/comment/609c4b2db684eb4cd52c2aa8)

it is not a good idea to store binary in database, instead you can store paths.

[Yemi Arigbanla](https://hashnode.com/@yemmyharry)

[May 13, 2021](https://hashnode.com/posts/how-to-store-an-image-to-a-database-with-react-using-base-64/609b660100bbde79d86a57d6/comment/609c4b2db684eb4cd52c2aa8#reply-609c93f247373d4cb055fda7)

Noted with thanks.

[Saquib Hussain](https://hashnode.com/@saquibxhussain)

[May 12, 2021](https://hashnode.com/posts/how-to-store-an-image-to-a-database-with-react-using-base-64/609b660100bbde79d86a57d6/comment/609b9c7bc798bd79ff8ed1dd)

Amazing! How long did it take to execute all this?
