---
title: "Discussion on \"Convert any Image to Base64 string data\" | Hashnode"
description: "Discussion on \"Convert any Image to Base64 string data\". First we have to Load the image as blob via XMLHttpRequest or fetch() and use the FileReader API ( readAsDataURL() ) to convert it to a dataURL:\nThis snippet can convert your String, Image and even Video file to Base64 string data.\nconst getBase64Fro..."
url: "https://hashnode.com/posts/convert-any-image-to-base64-string-data/5ffeb338c162d710c9b13bc1"
---

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

Discussion

# [Convert any Image to Base64 string data](https://lymcode.hashnode.dev/convert-any-image-to-base64-string-data?utm_source=hashnode&utm_medium=feed)

First we have to Load the image as blob via XMLHttpRequest or fetch() and use the FileReader API ( readAsDataURL() ) to convert it to a dataURL: This snippet can convert your String, Image and even Video file to Base64 string data. const getBase64Fro...

Jan 13, 2021 · 1 min read · lymcode.hashnode.dev  
Read the article

-   [#javascript](https://hashnode.com/tag/javascript)
-   [#images](https://hashnode.com/tag/images)
-   [#image-processing](https://hashnode.com/tag/image-processing)
-   [#reactjs](https://hashnode.com/tag/reactjs)

## Written by

[Lymcode](https://hashnode.com/@RoshanKrSoni)

@RoshanKrSoni · Ranchi, Jharkhand

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

Web Developer

Passionate Software developer

## Responses

Markdown supported · ⌘↵ to post

No responses yet.
