How long is a guid

I am generating a GUID and need to store this value in a db table. How long does the varchar datatype need to be to hold this value ?
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Depends on the GUID, but is usually a 128 bit number.  Therefore you need at least 128 and then some GUIDs have dashes or spaces to break it up into more readable sections - hence that is shy I said it depends.  I would say that 150 should be plenty for all cases.

A GUID is 16-bytes (128-bits) written in hex

    3F2504E0 4F89 11D3 9A 0C 03 05 E8 2C 33 01

GUIDs are written using a four-byte word, 3 two-byte words, and a six-byte word, such as:


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
In most generators they are written as SMithJW showed which is generally 32 characters excluding spaces and dashes and brackets and other divider characters.  If your generator does that then you should only need about 50 characters for the max case.  But my first post covered worst case scenario.

However, I recommend testing your generator and then going off of that.  It should be consistent each time from teh same generator.
Cloud Class® Course: MCSA MCSE Windows Server 2012

This course teaches how to install and configure Windows Server 2012 R2.  It is the first step on your path to becoming a Microsoft Certified Solutions Expert (MCSE).

It is safe to remove any formatting characters i beleive, as they are in the same position for every GUID... at least that was my interpretation of them, i could be wrong...
If im right though, id seperate just the meaningful data to save space.
but yeah, as richmon says, test the generator and handle it from there.
Have you considered storing the GUID as a "GUID-type" in the database (rather than a string)?   Most databases natively support a GUID type
As your probably aware,

System.Guid guid = System.Guid.NewGuid();
Split SmithJW {16271757} & mrichmon {16271838} & graye{16271874} & devsolns {16272338}
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.