C# Windows Form

C# Image File to Base64 String

In this example, there is the code to convert an image file into base64 string in C#.

You can to convert  a PNG  into base64 string format in C# by following code

I created this exmple in Windows Form Application with following components.

Add global variables in the Form1 Class

Double click btnOpen  and add these codes:

Double click btnSave  and add these codes:

All Codes:

Output:

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.